home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / dbase / softc103.zip / SOFTC.DOC < prev    next >
Text File  |  1989-05-11  |  190KB  |  4,535 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.                     SoftC (TM) Database Library Reference Manual
  18.  
  19.                                     Version 1.03
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.                       Manual and Software Copyright 1988, 1989
  41.                                          by
  42.                                     K. Schumann
  43.                             16820 3rd Street North East
  44.                              Ham Lake, Minnesota 55304
  45.                                    (612) 434-6968
  46.  
  47.                                 ALL RIGHTS RESERVED
  48.  
  49.  
  50.  
  51.  
  52.  
  53.             This document describes version 1.03 of the SoftC Database
  54.             Library, created in May 1989.
  55.  
  56.  
  57.  
  58.  
  59.  
  60.                                      DISCLAIMER
  61.  
  62.  
  63.             The  author  makes  no  representation  or  warranties  with
  64.             respect to  this  product  and  specifically  disclaims  any
  65.             implied warranties  or merchantability  or fitness  for  any
  66.             particular purpose.  The author shall have no liability with
  67.             respect  to   his  obligations   under  this  agreement  for
  68.             compensatory,   special,   incidental,   consequential,   or
  69.             exemplary damages.
  70.  
  71.  
  72.             The author further reserves the right to make changes to the
  73.             specifications of  the library  and contents  of the  manual
  74.             without obligation  to notify any person or organizations of
  75.             such changes.
  76.  
  77.  
  78.                                   Table of Contents
  79.  
  80.  
  81.  
  82.      Chapter 1 Introduction....................................1
  83.         Registration...........................................2
  84.         Registered users are entitled to one free update.......2
  85.         Typographic Conventions................................2
  86.         Trademarks.............................................3
  87.         Support and Updates....................................3
  88.         The Future.............................................3
  89.  
  90.      Chapter 2 Before You Begin................................4
  91.         The READ.ME File.......................................4
  92.         Installing SoftC on Your System........................4
  93.         SoftC Applications.....................................5
  94.         Compiling with Turbo C.................................5
  95.         Compiling with Microsoft C.............................6
  96.         Recompiling the SoftC Libraries........................6
  97.         Function Naming Conventions............................6
  98.  
  99.      Chapter 3 A dBase III Toolkit Tutorial....................7
  100.         Sequential Files.......................................7
  101.         Random Access Files....................................7
  102.         Keys...................................................7
  103.         ISAM and B-trees.......................................8
  104.         Basic Rules............................................9
  105.         Data File Functions....................................9
  106.         Data Record I/O........................................9
  107.         Data Field I/O........................................10
  108.         Index File Functions..................................11
  109.         Index Page Functions..................................11
  110.         Index Key Functions...................................11
  111.  
  112.      Chapter 4 Clock & Calendar Functions.....................13
  113.         Date String to Date String Conversion.................13
  114.         Date String to Numeric Conversion.....................13
  115.         Date Numeric to String Conversion.....................13
  116.         Date String Calculations..............................13
  117.         Date Validation and Testing...........................14
  118.  
  119.      Chapter 5 Miscellaneous Functions........................15
  120.         Program Initialization................................15
  121.         Program Termination...................................15
  122.         Library Version.......................................15
  123.         Errors................................................15
  124.  
  125.      Chapter 6 The SoftC Database Library.....................16
  126.         sccday................................................18
  127.         sccddiff..............................................19
  128.         sccdn2s...............................................20
  129.         sccds2l...............................................21
  130.         sccds2n...............................................21
  131.         sccdvalid.............................................22
  132.  
  133.  
  134.  
  135.                                          iii
  136.  
  137.  
  138.                                   Table of Contents
  139.  
  140.  
  141.         sccdxlat..............................................23
  142.         sccleap...............................................24
  143.         sccleapi..............................................25
  144.         sccmonth..............................................26
  145.         scdclose..............................................27
  146.         scdcreate.............................................28
  147.         scdfget...............................................29
  148.         scdfgets..............................................31
  149.         scdfinfo..............................................32
  150.         scdfnam2no............................................34
  151.         scdfput...............................................35
  152.         scdfputs..............................................36
  153.         scdinfo...............................................37
  154.         scdopen...............................................38
  155.         scdrclear.............................................39
  156.         scdrcopy..............................................40
  157.         scdrdel...............................................41
  158.         scdrget...............................................42
  159.         scdrinfo..............................................44
  160.         scdrput...............................................45
  161.         scdrundel.............................................46
  162.         scdsize...............................................47
  163.         sceclr................................................48
  164.         scemsg................................................49
  165.         sciclose..............................................50
  166.         scicreate.............................................51
  167.         sciexpr...............................................53
  168.         sciinfo...............................................54
  169.         scikadd...............................................55
  170.         scikcur...............................................56
  171.         scikdel...............................................57
  172.         scikfind..............................................58
  173.         scikfirst.............................................60
  174.         sciklast..............................................61
  175.         scikmake..............................................62
  176.         sciknext..............................................65
  177.         scikprev..............................................66
  178.         scinit................................................67
  179.         sciopen...............................................68
  180.         scipinfo..............................................69
  181.         scipnum...............................................70
  182.         scterm................................................71
  183.         scvers................................................72
  184.  
  185.      Appendix A License.......................................72
  186.  
  187.      Appendix B Order Form....................................74
  188.  
  189.      Appendix C Revision History..............................75
  190.         v1.00 (December of 1988)..............................75
  191.         v1.01 (February of 1989)..............................75
  192.  
  193.  
  194.  
  195.                                          iv
  196.  
  197.  
  198.                                   Table of Contents
  199.  
  200.  
  201.         v1.02 (April of 1989).................................76
  202.         v1.03 (May of 1989)...................................77
  203.  
  204.      Index....................................................78
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.                                           v
  256.  
  257.  
  258.           
  259.  
  260.  
  261.           Chapter 1          Chapter 1
  262.  
  263.  
  264.           Introduction          Introduction
  265.  
  266.  
  267.  
  268.  
  269.           C is generally considered to be a "bare-bones" language. A way to
  270.           put some flesh on those bones is to develop generalized functions
  271.           (extensions) which  may be  reused in many programs. The presence
  272.           of these  functions can make programming a quick and simple task.
  273.           The absence of these language extensions can mean many hours lost
  274.           "re-inventing the wheel".
  275.  
  276.  
  277.           Few programmers  have the time required to develop and debug such
  278.           a library  of functions. This is where the SoftC Database Library
  279.           comes in.  This library  is a collection of functions designed to
  280.           make your  applications quicker and easier to code and test. With
  281.           the library  you can  spend  time  on  your  application  not  on
  282.           developing tools.
  283.  
  284.  
  285.           There also  is a  benefit to  using functions  found in a toolkit
  286.           library versus  using the  functions  found  in  your  compiler's
  287.           library. It  may seem  trivial, but  if you ever decide to change
  288.           compilers you  will find  that it will take many hours to convert
  289.           your source  to match  the new compiler's syntax. Using a generic
  290.           toolkit such as SoftC will eliminate that effort.
  291.  
  292.  
  293.           SoftC adds powerful capabilities to your function library:
  294.  
  295.  
  296.                -database data and index file functions
  297.                -date and time manipulation and calculation
  298.  
  299.  
  300.           The SoftC Database Library is intended for use as a supplement to
  301.           your  compiler's   object  libraries.   It  contains   forty-nine
  302.           functions. Its  focus is  dBaseIII compatible data and index file
  303.           manipulation functions.  The clock/calendar  functions have  been
  304.           added  to  enhance  the  core  dBase  routines.  The  library  is
  305.           currently available  for Turbo  C 2.0  and Microsoft C 5.1. These
  306.           routines were written entirely in C.
  307.  
  308.  
  309.           The SoftC  Database Library  is the  copyrighted property  of  K.
  310.           Schumann. You  are granted  a limited license to use the library,
  311.           and  to   copy  and   distribute  the  following  files  (without
  312.           modification): SOFTC.H,   SCTC20S.LIB,  SCMSC51S.LIB,  SOFTC.DOC,
  313.           READ.ME, LICENSE.DOC and ORDER.DOC.
  314.  
  315.  
  316.           2    Chapter 1, Introduction          2                           
  317.  
  318.  
  319.           Registration          Registration
  320.  
  321.           If you  find this library useful, you are encouraged to register.
  322.           Refer to  ORDER.DOC for registration and update fees. To register
  323.           read the  file LICENSE.DOC,  print the file "ORDER.DOC", and mail
  324.           the completed form to:
  325.  
  326.  
  327.                                    Kim L. Schumann
  328.                              16820 3rd Street North East
  329.                               Ham Lake, Minnesota 55304
  330.  
  331.  
  332.           Registered users are entitled to one free update.
  333.  
  334.  
  335.           Shareware          Shareware
  336.  
  337.           This library is "shareware" (user supported software) NOT "public
  338.           domain". Which means that the library is the copyrighted property
  339.           of the  author, but  you are granted the right to make copies and
  340.           distribute it (under the conditions specified above) to anyone at
  341.           no cost. They are in turn requested to register if they decide to
  342.           use it.
  343.  
  344.  
  345.           The shareware concept is an attempt to provide useful software at
  346.           low cost.  The expense  of offering a new product by conventional
  347.           means is quite high and thus discourages many independent authors
  348.           and small  companies from  developing and  promoting their ideas.
  349.           Shareware is  an attempt to develop a new marketing channel where
  350.           products can be introduced at minimum cost.
  351.  
  352.  
  353.           Everyone will  benefit if  shareware works.  The user benefits by
  354.           receiving quality products at low cost, and by being able to test
  355.           software thoroughly  before purchasing it. The author benefits by
  356.           being able  to enter  the commercial  software market without the
  357.           need of large amounts of venture capital.
  358.  
  359.  
  360.           But it  can only  work with  your support.  If you  obtain a user
  361.           supported product  from a friend or coworker, and are still using
  362.           it after  a couple of weeks, then it is obviously worth something
  363.           to you, and a contribution should be sent.
  364.  
  365.  
  366.           Typographic Conventions          Typographic Conventions
  367.  
  368.           []             Square brackets enclose optional data.
  369.           Boldface       SoftC Library function names (such as          Boldface                                            
  370.                          scinit) and structure names when they                         scinit                               
  371.                           appear in text (but not in program
  372.                          examples).
  373.  
  374.  
  375.                                                Chapter 1, Introduction    3                                                                          3
  376.  
  377.  
  378.           Italics        indicate variable names (identifiers) that          _______                                 ___________      
  379.                          appear in text.
  380.  
  381.  
  382.           Trademarks          Trademarks
  383.  
  384.           Clipper is a registered trademark of Nantucket Software.
  385.           dBASEIII is a registered trademark of Ashton-Tate.
  386.           Microsoft is a registered trademark of Microsoft Corporation.
  387.           SoftC is a trademark of K. Schumann
  388.           Turbo C is a registered trademark of Borland International.
  389.  
  390.  
  391.           Support and Updates          Support and Updates
  392.  
  393.           I will  only offer  advice and  technical support  to  those  who
  394.           contribute via  the shareware concept. Users who register will be
  395.           notified when updates and new products are available.
  396.  
  397.  
  398.           I can  be contacted  by telephone  at (612)  434-6968  after  6pm
  399.           Central Time,  via mail  at the registration address above, or on
  400.           GEnie through GE Mail at "K.SCHUMANN".
  401.  
  402.  
  403.           The Future          The Future
  404.  
  405.           There are  many enhancements  that could  be made to the dBaseIII
  406.           routines: make  them LAN multi-user, add functions found in dBase
  407.           which do not have a corresponding C function, and add support for
  408.           dBaseIII MEMO fields. Extensions could be added to enable dBaseIV
  409.           file access.
  410.  
  411.  
  412.           Anyone wishing  to offer  advice and suggestions are most welcome
  413.           to do so.
  414.  
  415.  
  416.           
  417.  
  418.  
  419.           Chapter 2          Chapter 2
  420.  
  421.  
  422.           Before You Begin          Before You Begin
  423.  
  424.  
  425.  
  426.  
  427.           This chapter  supplies instructions for installing the library on
  428.           your hard disk and compiling the source.
  429.  
  430.  
  431.           The READ.ME File          The READ.ME File
  432.  
  433.           For  last   minute  update  information  not  contained  in  this
  434.           documentation, and/or a brief description of what's new with this
  435.           release please  read  the  READ.ME  file  found  on  the  library
  436.           diskette (or if you have the demonstration version of the library
  437.           it will be found in the .ARC file).
  438.  
  439.  
  440.           Installing SoftC on Your System          Installing SoftC on Your System
  441.  
  442.           The SoftC  Library source  code is  compatible with  all  of  the
  443.           compilers which  I support.  The object code diskette is for your
  444.           specific compiler. Check the label on this diskette to be sure it
  445.           is the  correct one.  It is  a good idea to recompile the library
  446.           when you upgrade your compiler.
  447.  
  448.  
  449.           Many compiler  manufacturers suggest a certain directory setup to
  450.           enable the  compiler to  find the  header,  object,  and  library
  451.           files. Rather  than trying  to explain  the various manufacturers
  452.           suggested  directory  setups,  I  will  explain  what  files  are
  453.           required and where they are often located.
  454.  
  455.  
  456.           The SoftC  header files need to be placed where they can be found
  457.           by your  compiler. In  many cases  this is in a special "INCLUDE"
  458.           directory. Other  times they are placed where your source code is
  459.           found. I would suggest that they be placed where the header files
  460.           for your compiler are located. All the header files will be found
  461.           on the source code diskette.
  462.  
  463.  
  464.           Your linker  will need  to be  able  to  find  the  SoftC  object
  465.           libraries. It  is suggested  that these  be placed where the run-
  466.           time libraries  for your compiler are found. These libraries will
  467.           be found on the library diskette.
  468.  
  469.  
  470.           The name  of the  library defines  the compiler  manufacturer and
  471.           version, and  the memory  model for  which it  was compiled.  All
  472.           library names  begin with  "SC". The  next few characters specify
  473.  
  474.  
  475.                                            Chapter 2, Before You Begin    5                                                                          5
  476.  
  477.  
  478.           the compiler  manufacturer. The last character defines the memory
  479.           model.
  480.  
  481.  
  482.           For example  SCTC20S.LIB is  the small  memory model  library for
  483.           Borland's Turbo C compiler (version 2.x).
  484.  
  485.  
  486.           SoftC Applications          SoftC Applications
  487.  
  488.           A typical application skeleton has the following form:
  489.  
  490.  
  491.  
  492.           #include <softc.h>
  493.           
  494.           /* global declarations */
  495.           
  496.           void main()
  497.           {
  498.             /* local declarations */
  499.           
  500.             scinit(20);
  501.             .
  502.             .
  503.             .
  504.             /* body of application */
  505.             .
  506.             .
  507.             .
  508.             scterm();
  509.           }
  510.  
  511.  
  512.  
  513.  
  514.  
  515.           The scinit  function must  be the  first function  called in your              scinit                                                       
  516.           application and  IT MUST  BE CALLED  ONLY ONCE. The last function                           IT MUST  BE CALLED  ONLY ONCE                   
  517.           should be  scterm. This  is not  a requirement  but  it  is  good                     scterm                                                
  518.           programming practice.  This function  should be called only once.
  519.           See the  descriptions of these functions in the library reference
  520.           section of this manual.
  521.  
  522.  
  523.           Compiling with Turbo C          Compiling with Turbo C
  524.  
  525.           Turbo C  provides two  ways of compiling programs: the integrated
  526.           environment and  the command  line version. In order to use SoftC
  527.           with the  integrated environment  a project  file must be created
  528.           and the appropriate library must be specified in that file:
  529.  
  530.  
  531.           6    Chapter 2, Before You Begin          6                               
  532.  
  533.  
  534.           myprog              /* your program name */
  535.           sctc20s.lib         /* the desired SoftC library */
  536.  
  537.  
  538.           To use  the library with the command line compiler simply include
  539.           the library name in filename list:
  540.  
  541.  
  542.           tcc -ml -I<header file path> -L<lib file path> myprog sctc20s.lib
  543.  
  544.  
  545.           Compiling with Microsoft C          Compiling with Microsoft C
  546.  
  547.           To use  the library with Microsoft's command line compiler simply
  548.           include the library name in filename list:
  549.  
  550.  
  551.           cl /AL /Zp myprog scmsc51s.lib
  552.  
  553.  
  554.           Recompiling the SoftC Libraries          Recompiling the SoftC Libraries
  555.  
  556.           If you  modify a SoftC source code file, then that module and any
  557.           related modules  (if any)  must be recompiled and replaced in the
  558.           libraries. The  library source  code is  compiled just  like  any
  559.           other SoftC program.
  560.  
  561.  
  562.           Turbo C command line:
  563.  
  564.  
  565.           tcc -c -ml -I<header file path> -f *.c
  566.  
  567.  
  568.           Microsoft C command line:
  569.  
  570.  
  571.           cl /AL /c /Zp /W3 *.c
  572.  
  573.  
  574.           Refer  to   your  compiler  documentation  for  instructions  for
  575.           replacing modules in libraries. Batch files are included with the
  576.           source code to assist you in rebuilding the libraries.
  577.  
  578.  
  579.           Function Naming Conventions          Function Naming Conventions
  580.  
  581.           All SoftC  functions begin  with the  letters "sc".  This  is  to
  582.           differentiate them from the standard library functions. The dBase
  583.           III data  file functions  begin with  "scd", the  dBase III index
  584.           file functions  with "sci", and the clock/calendar functions with
  585.           "scc".
  586.  
  587.  
  588.           
  589.  
  590.  
  591.           Chapter 3          Chapter 3
  592.  
  593.  
  594.           A dBase III Toolkit Tutorial          A dBase III Toolkit Tutorial
  595.  
  596.  
  597.  
  598.  
  599.           Most applications  need to  do some  file I/O  operations. Your C
  600.           compiler provides  you with  basic functions  to do  general file
  601.           I/O. But  many cases  will arise  when you need to use a database
  602.           within your  application. The  SoftC  Database  Library  provides
  603.           functions to  enable you  to integrate your program and dBase III
  604.           compatible data and index files.
  605.  
  606.  
  607.           For those of you who may be unfamiliar with databases, think of a
  608.           filing  cabinet   filled  with   folders  of   invoices   ordered
  609.           alphabetically  by   company  name.   If  we  wish  to  put  this
  610.           information "on  computer" we have two choices for data file I/O:
  611.           a simple sequential file, or a random access file.
  612.  
  613.  
  614.           Sequential Files          Sequential Files
  615.  
  616.           The concept  of using  a sequential file to store invoice data by
  617.           company name is very simple. Just enter the data as it's found in
  618.           the filing  cabinet. To access the information just begin reading
  619.           at the  start of the file and continue until finished. As you can
  620.           see the time required to find a specific record greatly increases
  621.           as more  and more  records are added to the file. Also the act of
  622.           adding information  to the  file  while  trying  to  keep  it  in
  623.           alphabetical order  becomes very  time consuming  due to the fact
  624.           that many records will have to be moved in order to make room for
  625.           the new record.
  626.  
  627.  
  628.           Random Access Files          Random Access Files
  629.  
  630.           By using  random access  techniques it  becomes  much  easier  to
  631.           access any  particular data  record. All  that is required is the
  632.           desired record  number and  you can  seek to  the proper location
  633.           within the  data file. But how do you know which record number to
  634.           use? And  what about  adding records  in the  middle of  the data
  635.           file? dBase uses keys and an indexed lookup system called ISAM to
  636.           solve both of these problems.
  637.  
  638.  
  639.           Keys          Keys
  640.  
  641.           Keys are generally comprised of one or more pieces of information
  642.           (data fields)  found in a data record. In our example the company
  643.           name could  be used as a key. Each key would point to one or more
  644.           records found  in the  data file.  When  many  keys  are  grouped
  645.  
  646.  
  647.           8    Chapter 3, A dBase III Toolkit Tutorial          8                                           
  648.  
  649.  
  650.           together they  form an  index file. dBase uses a technique called
  651.           ISAM to  access the  underlying B-tree  structure  of  its  index
  652.           files.
  653.  
  654.  
  655.           ISAM and B-trees          ISAM and B-trees
  656.  
  657.           The relationship between a key and the data file record number is
  658.           established via  a "key  item". Many  key items  are found  on an
  659.           "index page".  Many index  pages are  combined to  form an "index
  660.           file". The  method used  to navigate  through the  index file  is
  661.           called "Indexed  Sequential Access  Method" or  ISAM. B-tree  (or
  662.           branch tree)  is the underlying structure used in ISAM. Searching
  663.           always begins  at the  top of the tree. Each key item on an index
  664.           page  can  point  to  another  index  page  (this  is  where  the
  665.           "branching" comes  into play).  If a  key item  does not point to
  666.           another index  page it  is referred  to as  a "terminal  node". A
  667.           search is ended when a terminal node is encountered.
  668.  
  669.  
  670.           When a  data record  for a specific key needs to be accessed, The
  671.           first (top)  index page is searched with the desired key text. If
  672.           not at  a terminal  node, a  determination will be made using the
  673.           branch trees as to which index page should next be searched. This
  674.           sequence of  searching and branching is followed until a terminal
  675.           node is  encountered. If  an exact match is found the data record
  676.           number present  in that  key item  can be used to access the data
  677.           file.
  678.  
  679.  
  680.           When a key needs to be added to an index file, the above sequence
  681.           of searching  and branching  is again followed until the location
  682.           where the  new key  should be  placed is  found. Because  of  the
  683.           nature of the ISAM file it is much easier and faster to add a key
  684.           to the index page than appearances may indicate. If an index page
  685.           overflows it  will be  split  into  two  pages.  Likewise  if  it
  686.           underflows it will be joined with another index page. This system
  687.           results in a minimal amount of file I/O.
  688.  
  689.  
  690.           The first  question above  has been  obviously answered, but what
  691.           about the second? The answer lies in the fact that because we are
  692.           using an  index file  we no  longer have to keep the data file in
  693.           alphabetical order,  all we  need to  do is append records to the
  694.           end of the data file and add a key to the index file.
  695.  
  696.  
  697.           This ends  the general  discussion of  databases. One note, it is
  698.           good programming  practice to  create keys only from  data fields
  699.           found in  the data  record, this  allows the reconstruction of an
  700.           index file should something catastrophic happen.
  701.  
  702.  
  703.                                Chapter 3, A dBase III Toolkit Tutorial    9                                                                          9
  704.  
  705.  
  706.           Basic Rules          Basic Rules
  707.  
  708.           In order  to benefit fully from the SoftC Database Library, it is
  709.           necessary to  use only  the functions  found in  the library when
  710.           performing database  I/O. When standard functions such as fprintf                                                                    fprintf
  711.           are used, the SoftC database manager is bypassed. This means that
  712.           it can  no longer  keep track  of the activities in your database
  713.           files which can lead to unpredictable results.
  714.  
  715.  
  716.           This is  not to  say that  you cannot use the standard C file I/O
  717.           functions found  in your  compiler's  libraries,  but  their  use
  718.           should be restricted to non-database I/O.
  719.  
  720.  
  721.           Data File Functions          Data File Functions
  722.  
  723.           In order to use a data file it first must be opened. scdopen will                                                               scdopen     
  724.           open any  dBase III or dBase III+ compatible data file. The SoftC
  725.           database manager file handle will be returned. This handle number
  726.           must be used for all I/O with that specific data file.
  727.  
  728.  
  729.           When you  are finished  with a  data file  it is good practice to
  730.           close that  data file  via a call to scdclose. This is true for a                                               scdclose                    
  731.           couple of  reasons: 1)  The data will be safe if your application
  732.           crashes, and  2) computer  memory will  be freed for other use. A
  733.           safety net  is provided  by scterm in that it will close all data                                      scterm                               
  734.           and index files open at program termination.
  735.  
  736.  
  737.           The length  of the data file in bytes can be found using scdsize.                                                                   scdsize 
  738.           The name of the data file associated with a particular handle can
  739.           be retrieved  via a  call to scdinfo. Also a new data file can be                                       scdinfo                             
  740.           created by scdcreate.                     scdcreate 
  741.  
  742.  
  743.           Data Record I/O          Data Record I/O
  744.  
  745.           Having a data file is of little use unless you can manipulate the
  746.           individual records. SoftC provides seven functions to: read/write
  747.           individual records,  delete/recover deleted  records,  manipulate
  748.           I/O buffers, and retrieve information about the record structure.
  749.  
  750.  
  751.           A data  record can  be read from the data file using scdrget. The                                                               scdrget     
  752.           actual data  will be  placed in  a SoftC internal buffer. See the
  753.           discussion on  Data Field  I/O for  more information on accessing
  754.           the individual  fields found in a data record. When a data record
  755.           needs to  be written  to the  file, scdrput  should be used. This                                              scdrput                      
  756.           function is  used both  for the  changing of  a record as well as
  757.           adding new records.
  758.  
  759.  
  760.           10    Chapter 3, A dBase III Toolkit Tutorial          10                                           
  761.  
  762.  
  763.           dBase III  data records  are not physically removed from the data
  764.           file when  they are  deleted. This enables the user to change his
  765.           mind and recover the deleted records for use again. SoftC follows
  766.           this guideline  by providing  the scdrdel function to mark a data                                            scdrdel                        
  767.           record as  deleted, and  the scdrundel  function to  recover  the                                       scdrundel                           
  768.           record (or mark as active).
  769.  
  770.  
  771.           Information about the data record structure can be retrieved by a
  772.           called to  scdrinfo. The  record length,  number of fields in the                     scdrinfo                                              
  773.           data record, and the addresses of the I/O buffers can be obtained
  774.           in this way.
  775.  
  776.  
  777.           Two additional functions are provided which deal exclusively with
  778.           the  internal   SoftC  I/O   buffers:  scdrclear,  and  scdrcopy.                                                 scdrclear        scdrcopy 
  779.           scdrclear is  useful in clearing the output buffer before placing          scdrclear                                                        
  780.           data in the individual fields. The entire data record will be set
  781.           to spaces (" "). This has the effect on numeric fields of placing
  782.           nothing in  the field  rather than  zero. scdrcopy  can be useful                                                    scdrcopy               
  783.           when a  record needs to be updated but the original also needs to
  784.           be retained.
  785.  
  786.  
  787.           Data Field I/O          Data Field I/O
  788.  
  789.           The six  data  field  manipulation  functions  provide  for:  the
  790.           writing of  data to  a field in the output buffer, the reading of
  791.           data from  a field  in the  input buffer, the conversion of field
  792.           names  to   field  numbers,   and  the  retrieval  of  the  field
  793.           descriptions originally setup with scdcreate.                                             scdcreate 
  794.  
  795.  
  796.           There are  two types  of field  I/O: standard  C types and ASCIIZ
  797.           string. scdfput  and scdfget  use the  standard C  types below to                  scdfput      scdfget                                     
  798.           place data  in and  retrieve data  from individual  fields  in  a
  799.           record. scdfput  attempts to  properly  format  the  data  before                  scdfput                                                  
  800.           placing it  in the  field. This  means that  the proper number of
  801.           spaces,  zeros,   and/or  a   decimal  point  will  be  added  as
  802.           appropriate.
  803.  
  804.  
  805.           C types                  dBase III types
  806.           char [9]                 date
  807.           ASCIIZ string            character
  808.           double                   numeric
  809.           char                     logical
  810.  
  811.  
  812.           scdfputs and  scdfgets use ASCIIZ strings exclusively. It is left          scdfputs      scdfgets                                           
  813.           up to  the users  of these  functions to  ensure that the data is
  814.           properly formatted. Both "scdfput" functions work with the output
  815.           buffer, and the "scdfget" functions work with the input buffer.
  816.  
  817.  
  818.                               Chapter 3, A dBase III Toolkit Tutorial    11                                                                         11
  819.  
  820.  
  821.           A field name to field number translation function (scdfnam2no) is                                                             scdfnam2no    
  822.           provided to  isolate your  application from  the structure of the
  823.           data files.
  824.  
  825.  
  826.           Index File Functions          Index File Functions
  827.  
  828.           In order  to use  an index  file it first must be opened. sciopen                                                                    sciopen
  829.           will open  any dBase III or dBase III+ compatible index file. The
  830.           index files  created by Clipper are not compatible with dBase III
  831.           (and thusly  with this  library). The SoftC database manager file
  832.           handle will  be returned. This handle number must be used for all
  833.           I/O with that specific index file.
  834.  
  835.  
  836.           When you  are finished with an index file, it can be closed via a
  837.           call to  sciclose. Information  about the  index file such as the                   sciclose                                                
  838.           file name  and length of the key expression can be retrieved by a
  839.           call to  sciinfo. A  new index  file can  be created by using the                   sciinfo                                                 
  840.           function scicreate.                   scicreate 
  841.  
  842.  
  843.           sciexpr can  be used to get the actual index key expression. This          sciexpr                                                          
  844.           key expression  is generally  a formula  listing the  field names
  845.           used to make the index key. For example, FIRST_NAME and LAST_NAME
  846.           are both  fields found  in a  data file, if an index key was made
  847.           from the  combination of these fields the key expression could be
  848.           "LAST_NAME + FIRST_NAME".
  849.  
  850.  
  851.           Index Page Functions          Index Page Functions
  852.  
  853.           If memory  is available  the SoftC database manager will allocate
  854.           space for  ten index  pages. In some instances more or less pages
  855.           may be  needed to  provide  fast  access  to  index  information.
  856.           scipinfo is  used to  find out how many pages for which space was          scipinfo                                                         
  857.           allocated. To  change the  number of  pages for  which memory was
  858.           allocated, scipnum can be used.                     scipnum             
  859.  
  860.  
  861.           Index Key Functions          Index Key Functions
  862.  
  863.           Nine functions  have been  provided for  use in:  finding a  key,
  864.           moving to  the next  or  previous  key,  adding/deleting  a  key,
  865.           retrieving the  current key,  and building a key. There are three
  866.           search functions  supported: find  first key (scikfirst), finding                                                        scikfirst          
  867.           the last  key  (sciklast),  and  searching  for  a  specific  key                          sciklast                                         
  868.           (scikfind). The  keys found  in this  manner become  the "current           scikfind                                                        
  869.           key". Wildcards such as "?" and "*" cannot be used.
  870.  
  871.  
  872.           Once a particular key is found it is often desired to get the key
  873.           following (sciknext)  or the  key preceding  (scikprev) it. These                     sciknext                           scikprev           
  874.  
  875.  
  876.           12    Chapter 3, A dBase III Toolkit Tutorial          12                                           
  877.  
  878.  
  879.           keys, if  found, become  the current  key.  Another  function  is
  880.           provided to return the current key, scikcur.                                              scikcur 
  881.  
  882.  
  883.           It also  desirable to  be able  to add  and delete  keys from the
  884.           index file.  scikadd and  scikdel provide  these functions. These                       scikadd      scikdel                                
  885.           functions also  attempt to  keep the B-tree balanced, so that one
  886.           branch of the tree will not grow larger than the others.
  887.  
  888.  
  889.           dBaseIII provides  certain functions  which may  be used in a key
  890.           expression. scikmake will build a key for you using the index key                      scikmake                                             
  891.           expression and  the contents  of the  current output buffer. This
  892.           function supports  five of  the more  common dBaseIII  functions:
  893.           dtoc, left,  right, str,  and substr  (and the various legitimate          dtoc  left   right  str       substr                             
  894.           combinations of  them). Note  that this function is not necessary
  895.           for single field character or numeric keys, but it should be used
  896.           for date keys.
  897.  
  898.  
  899.           
  900.  
  901.  
  902.           Chapter 4          Chapter 4
  903.  
  904.  
  905.           Clock & Calendar Functions          Clock & Calendar Functions
  906.  
  907.  
  908.  
  909.  
  910.           This chapter  will describe  the date  functions available in the
  911.           SoftC  Database   Library.  Currently  there  are  ten  functions
  912.           implemented. Note  that the  date format  is "yyyymmdd"  for  all
  913.           functions unless otherwise specified.
  914.  
  915.  
  916.           Date String to Date String Conversion          Date String to Date String Conversion
  917.  
  918.           Internal to dBaseIII the date fields are formatted as "yyyymmdd".
  919.           This format  enables the  date field  to be  used properly  as an
  920.           index key and ensures that the date February 13, 1989 will always
  921.           be larger  than the  date December  15, 1988. Note that this date
  922.           format is  not the  one normally used when entering or displaying
  923.           dates. If  fact dBaseIII  uses the date format "mm/dd/yy" when it
  924.           displays dates.
  925.  
  926.  
  927.           A function  sccdxlat was created to allow switching between these                      sccdxlat                                             
  928.           two formats.  An additional format is provided to enable the year
  929.           section of  the  date  to  more  accurately  represent  the  year
  930.           entered. This format is "mm/dd/yyyy".
  931.  
  932.  
  933.           Date String to Numeric Conversion          Date String to Numeric Conversion
  934.  
  935.           Along with  character string  dates, SoftC  supports two types of
  936.           numeric dates:  year, month,  and day in integer form, and number
  937.           of elapsed  days in long integer form. sccds2n is used to convert                                                 sccds2n                   
  938.           from a  character string  to integers,  and sccds2l  will convert                                                      sccds2l              
  939.           from string to long integer.
  940.  
  941.  
  942.           Date Numeric to String Conversion          Date Numeric to String Conversion
  943.  
  944.           SoftC also  supports the  conversion to  character strings, where
  945.           sccdn2s converts  integers to  a string. Two additional functions          sccdn2s                                                          
  946.           are included  to return  character strings  for  an  integer  day
  947.           (sccday) or  month (sccmonth)  input, for  example "Thursday", or           sccday             sccmonth                                     
  948.           "March".
  949.  
  950.  
  951.           Date String Calculations          Date String Calculations
  952.  
  953.           sccddiff will compute the difference in days between two dates.          sccddiff                                                       
  954.  
  955.  
  956.           14    Chapter 4, Clock & Calendar Functions          14                                         
  957.  
  958.  
  959.           Date Validation and Testing          Date Validation and Testing
  960.  
  961.           Two functions  are provided to test for leap year: one requires a
  962.           character string  as input  (sccleap) and  the other  an  integer                                       sccleap                             
  963.           (sccleapi). Also sccdvalid can be used to check the validity of a           sccleapi        sccdvalid                                       
  964.           date string.
  965.  
  966.  
  967.           
  968.  
  969.  
  970.           Chapter 5          Chapter 5
  971.  
  972.  
  973.           Miscellaneous Functions          Miscellaneous Functions
  974.  
  975.  
  976.  
  977.  
  978.           This chapter  will describe  the miscellaneous functions found in
  979.           the SoftC Database Library.
  980.  
  981.  
  982.           Program Initialization          Program Initialization
  983.  
  984.           scinit sets  up  the  SoftC  database  manager.  Memory  will  be          scinit                                                           
  985.           allocated for  a variety  of internal  structures. As  previously
  986.           mentioned this  function  should  be  called  only  once  at  the
  987.           beginning of your application.
  988.  
  989.  
  990.           Program Termination          Program Termination
  991.  
  992.           scterm is  called at  the end  of your application. It will close          scterm                                                           
  993.           all database files and free the memory allocated by scinit.                                                              scinit 
  994.  
  995.  
  996.           Library Version          Library Version
  997.  
  998.           The  scvers  function  has  been  provided  to  retrieve  a  NULL               scvers                                                      
  999.           terminated character  string containing  the version of the SoftC
  1000.           library you  are currently  using. This  can then  be printed  by
  1001.           puts.          puts 
  1002.  
  1003.  
  1004.           Errors          Errors
  1005.  
  1006.           A global  variable sc_code  will contain  the results of the last                             sc_code                                       
  1007.           SoftC function  call executed.  Errors are  indicated by negative
  1008.           numbers, warnings  by positive  numbers greater  than zero, and a
  1009.           zero  indicates   success.  During   program  debug   it  may  be
  1010.           advantageous to  print  the  text  message  associated  with  the
  1011.           contents of  sc_code. scemsg  will  return  the  address  of  the                       sc_code  scemsg                                     
  1012.           message associated  with the  contents of sc_code, which can then                                                    sc_code                
  1013.           be printed by puts.                        puts 
  1014.  
  1015.  
  1016.           If you  desire to  clear an error or warning condition either the
  1017.           global variable sc_code can be set to zero or the function sceclr                          sc_code                                    sceclr
  1018.           can be used. It is preferable to use the function rather than the
  1019.           global variable.
  1020.  
  1021.  
  1022.           
  1023.  
  1024.  
  1025.           Chapter 6          Chapter 6
  1026.  
  1027.  
  1028.           The SoftC Database Library          The SoftC Database Library
  1029.  
  1030.  
  1031.  
  1032.  
  1033.           This chapter  contains a  detailed description  of  each  of  the
  1034.           functions in the library.
  1035.  
  1036.  
  1037.           The following  sample function  description explains  how to  use
  1038.           this portion of the SoftC Database Library Reference Manual.
  1039.  
  1040.  
  1041.           function name          function name          _____________
  1042.  
  1043.  
  1044.  
  1045.  
  1046.           Usage          Usage          _____
  1047.                     function(modifier parameter[,...]);                    function                                                                 _________        
  1048.  
  1049.  
  1050.                     The declaration  syntax for  function, parameter  names                                                 function                                                                             _________       
  1051.                     are  italicized.   The  [,...]   indicates  that  other
  1052.                     parameters and their modifiers may follow.
  1053.  
  1054.  
  1055.           Prototype in          Prototype in          ____________
  1056.                     This lists  the header  files in  which the function is
  1057.                     prototyped.
  1058.  
  1059.  
  1060.           Description          Description          ___________
  1061.                     This describes  what the  function does, the parameters
  1062.                     it takes,  and any  details you  need in  order to  use
  1063.                     function and the related routines listed.
  1064.  
  1065.  
  1066.           See also          See also          ________
  1067.                     Routines related  to the  function about  which you may
  1068.                     wish to read are listed here.
  1069.  
  1070.  
  1071.           Return Value          Return Value          ____________
  1072.                     The value(s)  that the  function returns  (if any)  are
  1073.                     listed here.  The return  value will  also  be  set  in
  1074.                     sc_code.  Unless   otherwise  noted   in  the  specific                    sc_code                                                
  1075.                     function description, the function call will be ignored
  1076.                     if sc_code contains an error (values less than zero). A                       sc_code                                             
  1077.                     good return  will always  be equal to zero. Any warning
  1078.                     codes are always greater than zero.
  1079.  
  1080.  
  1081.                                 Chapter 6, The SoftC Database Library    17                                                                         17
  1082.  
  1083.  
  1084.           Example          Example          _______
  1085.                     A sample program listing demonstrating how the function
  1086.                     is used.
  1087.  
  1088.  
  1089.           18    Chapter 6, The SoftC Database Library          18                                         
  1090.  
  1091.  
  1092.           sccday          sccday          ______
  1093.  
  1094.  
  1095.  
  1096.  
  1097.           Usage          Usage          _____
  1098.                     signed short int sccday( signed char day,                                     sccday                                                                           ___ 
  1099.                                              signed char daystr[10] );                                                         ______       
  1100.  
  1101.  
  1102.           Prototype in          Prototype in          ____________
  1103.                     SoftC.h
  1104.  
  1105.  
  1106.           Description          Description          ___________
  1107.                     sccday returns the day of the week string in daystr for                    sccday                                                                                                                  ______    
  1108.                     the day specified by day. day must be in the range of 0                                         ___  ___                          
  1109.                     (Sunday) to  6 (Saturday).  The maximum  length of  the
  1110.                     string returned will be 9 plus the NULL byte.
  1111.  
  1112.  
  1113.           See also          See also          ________
  1114.                     sccmonth                    sccmonth
  1115.  
  1116.  
  1117.           Return Value          Return Value          ____________
  1118.                     SC_SUCCESS     function successful
  1119.                     SC_BADDATE     invalid date
  1120.                     SC_NULLPARM    parameter address null
  1121.  
  1122.  
  1123.           Example          Example          _______
  1124.  
  1125.           #include "SoftC.h"
  1126.           
  1127.           void main()
  1128.           {
  1129.             char day[10];
  1130.           
  1131.             scinit(1);
  1132.             sccday(0,day);
  1133.             puts(day);
  1134.             scterm();
  1135.           }
  1136.  
  1137.  
  1138.                                 Chapter 6, The SoftC Database Library    19                                                                         19
  1139.  
  1140.  
  1141.           sccddiff          sccddiff          ________
  1142.  
  1143.  
  1144.  
  1145.  
  1146.           Usage          Usage          _____
  1147.                     signed short int sccddiff( signed char *date1,                                     sccddiff                                                                                 _____ 
  1148.                                                signed char *date2,                                                            _____ 
  1149.                                                signed long *diff );                                                            ____   
  1150.  
  1151.  
  1152.           Prototype in          Prototype in          ____________
  1153.                     SoftC.h
  1154.  
  1155.  
  1156.           Description          Description          ___________
  1157.                     sccddiff returns  the difference  in days between date1                    sccddiff                                                                                                                     _____
  1158.                     and date2.  The two  date strings  can be in any order,                        _____                                              
  1159.                     but must  be valid   dates of the format "yyyymmdd" (eg
  1160.                     "19890213"). This is the date format used internally by
  1161.                     the SoftC  database manager.  sccdxlat can  be used  to                                                  sccdxlat                 
  1162.                     translate an  existing date string to this format, or a
  1163.                     date string can be built using sccdn2s.                                                   sccdn2s 
  1164.  
  1165.  
  1166.           See also          See also          ________
  1167.                     sccdxlat, sccdn2s, sccdvalid.                    sccdxlat  sccdn2s  sccdvalid 
  1168.  
  1169.  
  1170.           Return Value          Return Value          ____________
  1171.                     SC_SUCCESS     calculation successful
  1172.                     SC_BADDATE     invalid date
  1173.                     SC_NULLPARM    parameter address null
  1174.  
  1175.  
  1176.           Example          Example          _______
  1177.  
  1178.           #include "SoftC.h"
  1179.           
  1180.           void main()
  1181.           {
  1182.             signed long d;
  1183.           
  1184.             scinit(1);
  1185.             sccddiff("19890213","19881217",&d);
  1186.             printf("%ld",d);
  1187.             scterm();
  1188.           }
  1189.  
  1190.  
  1191.           20    Chapter 6, The SoftC Database Library          20                                         
  1192.  
  1193.  
  1194.           sccdn2s          sccdn2s          _______
  1195.  
  1196.  
  1197.  
  1198.  
  1199.           Usage          Usage          _____
  1200.                     signed short int sccdn2s( signed int year,                                     sccdn2s                                                                           ____ 
  1201.                                               signed int month,                                                         _____ 
  1202.                                               signed int day,                                                         ___ 
  1203.                                               signed char *string );                                                           ______   
  1204.  
  1205.  
  1206.           Prototype in          Prototype in          ____________
  1207.                     SoftC.h
  1208.  
  1209.  
  1210.           Description          Description          ___________
  1211.                     sccdn2s  converts  three  integer  date  values  (year,                    sccdn2s                                                                                                                      ____ 
  1212.                     month, and  day) into  a character  string (string).  A                    _____       ___                             ______     
  1213.                     check is  made to  verify that  string is  a valid date                                                    ______                 
  1214.                     string before exiting.
  1215.  
  1216.  
  1217.           See also          See also          ________
  1218.                     sccdvalid, sccds2n.                    sccdvalid  sccds2n 
  1219.  
  1220.  
  1221.           Return Value          Return Value          ____________
  1222.                     SC_SUCCESS     conversion successful
  1223.                     SC_BADDATE     invalid date
  1224.                     SC_NULLPARM    parameter address null
  1225.  
  1226.  
  1227.           Example          Example          _______
  1228.  
  1229.           #include "SoftC.h"
  1230.           
  1231.           void main()
  1232.           {
  1233.             signed char d[9];
  1234.           
  1235.             scinit(1);
  1236.             sccdn2s(1989,2,13,d);
  1237.             puts(d);
  1238.             scterm();
  1239.           }
  1240.  
  1241.  
  1242.                                 Chapter 6, The SoftC Database Library    21                                                                         21
  1243.  
  1244.  
  1245.           sccds2l          sccds2l          _______
  1246.  
  1247.  
  1248.  
  1249.  
  1250.           Usage          Usage          _____
  1251.                     signed short int sccds2l( signed char *string,                                     sccds2l                                                                                 ______ 
  1252.                                               signed long *date );                                                           ____   
  1253.  
  1254.  
  1255.           Prototype in          Prototype in          ____________
  1256.                     SoftC.h
  1257.  
  1258.  
  1259.           Description          Description          ___________
  1260.                     sccds2l converts  a character  string (string)  into  a                    sccds2l                                                                                                           ______          
  1261.                     long date.                         ____ 
  1262.  
  1263.  
  1264.           Return Value          Return Value          ____________
  1265.                     SC_SUCCESS     conversion successful
  1266.                     SC_BADDATE     invalid date
  1267.                     SC_NULLPARM    parameter address null
  1268.  
  1269.  
  1270.           Example          Example          _______
  1271.  
  1272.           #include "SoftC.h"
  1273.           
  1274.           void main()
  1275.           {
  1276.             signed long l;
  1277.           
  1278.             scinit(1);
  1279.             sccds2l("19890323",&l);
  1280.             printf("%ld",l);
  1281.             scterm();
  1282.           }
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.           sccds2n          sccds2n          _______
  1289.  
  1290.  
  1291.  
  1292.  
  1293.           Usage          Usage          _____
  1294.                     signed short int sccds2n( signed char *string,                                     sccds2n                                                                                 ______ 
  1295.                                               signed int *year,                                                          ____ 
  1296.                                               signed int *month,                                                          _____ 
  1297.                                               signed int *day );                                                          ___   
  1298.  
  1299.  
  1300.           22    Chapter 6, The SoftC Database Library          22                                         
  1301.  
  1302.  
  1303.           Prototype in          Prototype in          ____________
  1304.                     SoftC.h
  1305.  
  1306.  
  1307.           Description          Description          ___________
  1308.                     sccds2n converts dates from a character string (string)                    sccds2n                                                                                                                    ______ 
  1309.                     to three  integer values  (year,  month,  and  day).  A                                               ____   _____        ___     
  1310.                     partial check  is made to verify that string is a valid                                                          ______           
  1311.                     date string before attempting to convert.
  1312.  
  1313.  
  1314.           See also          See also          ________
  1315.                     sccdn2s.                    sccdn2s 
  1316.  
  1317.  
  1318.           Return Value          Return Value          ____________
  1319.                     SC_SUCCESS     conversion successful
  1320.                     SC_BADDATE     invalid date
  1321.                     SC_NULLPARM    parameter address null
  1322.  
  1323.  
  1324.           Example          Example          _______
  1325.  
  1326.           #include "SoftC.h"
  1327.           
  1328.           void main()
  1329.           {
  1330.             signed int y, m, d;
  1331.           
  1332.             scinit(1);
  1333.             sccds2n("19890213",&y,&m,&d);
  1334.             printf("%d %d %d",y,m,d);
  1335.             scterm();
  1336.           }
  1337.  
  1338.  
  1339.  
  1340.  
  1341.  
  1342.           sccdvalid          sccdvalid          _________
  1343.  
  1344.  
  1345.  
  1346.  
  1347.           Usage          Usage          _____
  1348.                     signed short int sccdvalid( signed char *string );                                     sccdvalid                                                                                     ______   
  1349.  
  1350.  
  1351.           Prototype in          Prototype in          ____________
  1352.                     SoftC.h
  1353.  
  1354.  
  1355.                                 Chapter 6, The SoftC Database Library    23                                                                         23
  1356.  
  1357.  
  1358.           Description          Description          ___________
  1359.                     sccdvalid tests  the date  string (string)  passed  for                    sccdvalid                                                                                                     ______              
  1360.                     validity: string properly formatted ("yyyymmdd"), valid
  1361.                     day of month, valid month of year.
  1362.  
  1363.  
  1364.           Return Value          Return Value          ____________
  1365.                     SC_SUCCESS     valid date
  1366.                     SC_BADDATE     invalid date
  1367.                     SC_NULLPARM    parameter address null
  1368.  
  1369.  
  1370.           Example          Example          _______
  1371.  
  1372.           #include "SoftC.h"
  1373.           
  1374.           void main()
  1375.           {
  1376.             scinit(1);
  1377.             if (sccdvalid("19890213") == SC_SUCCESS)
  1378.               puts("Good Date.");
  1379.             else
  1380.               puts("Bad Date.");
  1381.             scterm();
  1382.           }
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.           sccdxlat          sccdxlat          ________
  1389.  
  1390.  
  1391.  
  1392.  
  1393.           Usage          Usage          _____
  1394.                     signed short int sccdxlat( signed char method,                                     sccdxlat                                                                                ______ 
  1395.                                                signed char *source,                                                            ______ 
  1396.                                                signed char *dest );                                                            ____   
  1397.  
  1398.  
  1399.           Prototype in          Prototype in          ____________
  1400.                     SoftC.h
  1401.  
  1402.  
  1403.           Description          Description          ___________
  1404.                     sccdxlat translates  from one  date  string  format  to                    sccdxlat                                               
  1405.                     another  under   control  of  method.  Currently  three                                                  ______                   
  1406.                     translation methods  are supported:  SC_2ASCII  -  from
  1407.                     "yyyymmdd" to  "mm/dd/yy", SC_2ASCIIL - from "yyyymmdd"
  1408.                     to "mm/dd/yyyy", and SC_2DBASE - from "mm/dd/[yy]yy" to
  1409.                     "yyyymmdd".
  1410.  
  1411.  
  1412.           24    Chapter 6, The SoftC Database Library          24                                         
  1413.  
  1414.  
  1415.                     The  maximum   lengths  of   dest  and  source  are  10                                                 ____       ______         
  1416.                     characters (plus the NULL byte).
  1417.  
  1418.  
  1419.                     Note that when converting using SC_2DBASE dates such as
  1420.                     "2/1/89" will be translated to "19890201".
  1421.  
  1422.  
  1423.           Return Value          Return Value          ____________
  1424.                     SC_SUCCESS     translation successful
  1425.                     SC_BADCMD      invalid translation method                                                       ______
  1426.                     SC_BADDATE     invalid date
  1427.                     SC_NULLPARM    parameter address null
  1428.  
  1429.  
  1430.           Example          Example          _______
  1431.  
  1432.           #include "SoftC.h"
  1433.           
  1434.           void main()
  1435.           {
  1436.             char date[11];
  1437.           
  1438.             scinit(1);
  1439.             sccdxlat(SC_2ASCII,"2/1/89",date);
  1440.             puts(date);
  1441.             scterm();
  1442.           }
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.           sccleap          sccleap          _______
  1449.  
  1450.  
  1451.  
  1452.  
  1453.           Usage          Usage          _____
  1454.                     signed short int sccleap( signed char *leap );                                     sccleap                                                                                 ____   
  1455.  
  1456.  
  1457.           Prototype in          Prototype in          ____________
  1458.                     SoftC.h
  1459.  
  1460.  
  1461.           Description          Description          ___________
  1462.                     sccleap tests  the string  year passed to it in leap to                    sccleap                                                                                                                    ____   
  1463.                     see if it is a leap year.
  1464.  
  1465.  
  1466.           See also          See also          ________
  1467.                     sccleapi                    sccleapi
  1468.  
  1469.  
  1470.                                 Chapter 6, The SoftC Database Library    25                                                                         25
  1471.  
  1472.  
  1473.           Return Value          Return Value          ____________
  1474.                     > 0            year was a leap year
  1475.                     SC_SUCCESS     year was not a leap year
  1476.                     SC_BADDATE     invalid date
  1477.                     SC_NULLPARM    parameter address null
  1478.  
  1479.  
  1480.           Example          Example          _______
  1481.  
  1482.           #include "SoftC.h"
  1483.           
  1484.           void main()
  1485.           {
  1486.           
  1487.             scinit(1);
  1488.             if (sccleap("1989")
  1489.               puts("Leap Year!");
  1490.             else
  1491.               puts("Normal Year.");
  1492.             scterm();
  1493.           }
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.           sccleapi          sccleapi          ________
  1500.  
  1501.  
  1502.  
  1503.  
  1504.           Usage          Usage          _____
  1505.                     signed short int sccleapi( signed int leap );                                     sccleapi                                                                              ____   
  1506.  
  1507.  
  1508.           Prototype in          Prototype in          ____________
  1509.                     SoftC.h
  1510.  
  1511.  
  1512.           Description          Description          ___________
  1513.                     sccleapi tests the integer year passed to it in leap to                    sccleapi                                                                                                                   ____   
  1514.                     see if it is a leap year.
  1515.  
  1516.  
  1517.           See also          See also          ________
  1518.                     sccleap                    sccleap
  1519.  
  1520.  
  1521.           Return Value          Return Value          ____________
  1522.                     > 0            year was a leap year
  1523.                     SC_SUCCESS     year was not a leap year
  1524.                     SC_BADDATE     invalid date
  1525.                     SC_NULLPARM    parameter address null
  1526.  
  1527.  
  1528.           26    Chapter 6, The SoftC Database Library          26                                         
  1529.  
  1530.  
  1531.           Example          Example          _______
  1532.  
  1533.           #include "SoftC.h"
  1534.           
  1535.           void main()
  1536.           {
  1537.           
  1538.             scinit(1);
  1539.             if (sccleap(1989)
  1540.               puts("Leap Year!");
  1541.             else
  1542.               puts("Normal Year.");
  1543.             scterm();
  1544.           }
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.           sccmonth          sccmonth          ________
  1551.  
  1552.  
  1553.  
  1554.  
  1555.           Usage          Usage          _____
  1556.                     signed short int sccmonth( signed char month,                                     sccmonth                                                                               _____ 
  1557.                                                signed char monthstr[10] );                                                           ________       
  1558.  
  1559.  
  1560.           Prototype in          Prototype in          ____________
  1561.                     SoftC.h
  1562.  
  1563.  
  1564.           Description          Description          ___________
  1565.                     sccmonth returns  the month  string in monthstr for the                    sccmonth                                                                                                          ________        
  1566.                     month specified by month. month must be in the range of                                       _____  _____                        
  1567.                     1 (January) to 12 (December). The maximum length of the
  1568.                     string returned will be 9 plus the NULL byte.
  1569.  
  1570.  
  1571.           See also          See also          ________
  1572.                     sccday                    sccday
  1573.  
  1574.  
  1575.           Return Value          Return Value          ____________
  1576.                     SC_SUCCESS     function successful
  1577.                     SC_BADDATE     invalid date
  1578.                     SC_NULLPARM    parameter address null
  1579.  
  1580.  
  1581.           Example          Example          _______
  1582.  
  1583.           #include "SoftC.h"
  1584.           
  1585.  
  1586.  
  1587.                                 Chapter 6, The SoftC Database Library    27                                                                         27
  1588.  
  1589.  
  1590.           void main()
  1591.           {
  1592.             char month[10];
  1593.           
  1594.             scinit(1);
  1595.             sccmonth(4,month);
  1596.             puts(month);
  1597.             scterm();
  1598.           }
  1599.  
  1600.  
  1601.  
  1602.  
  1603.  
  1604.           scdclose          scdclose          ________
  1605.  
  1606.  
  1607.  
  1608.  
  1609.           Usage          Usage          _____
  1610.                     signed short int scdclose( signed char handle );                                     scdclose                                                                                  ______   
  1611.  
  1612.  
  1613.           Prototype in          Prototype in          ____________
  1614.                     dbase.h
  1615.  
  1616.  
  1617.           Description          Description          ___________
  1618.                     scdclose closes  a .DBF  file and  frees all  allocated                    scdclose                                               
  1619.                     memory associated with .DBF file handle.
  1620.  
  1621.  
  1622.           See also          See also          ________
  1623.                     scdopen                    scdopen
  1624.  
  1625.  
  1626.           Return Value          Return Value          ____________
  1627.                     SC_SUCCESS     .DBF file closed
  1628.                     SC_CLOSFAIL    file close failure
  1629.                     SC_BADHNDL     .DBF file not open or bad handle
  1630.  
  1631.  
  1632.           Example          Example          _______
  1633.  
  1634.           #include "SoftC.h"
  1635.           
  1636.           
  1637.           void main()
  1638.           {
  1639.             char dbf;
  1640.           
  1641.             scinit(20);
  1642.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS)
  1643.               scdclose(dbf);
  1644.  
  1645.  
  1646.           28    Chapter 6, The SoftC Database Library          28                                         
  1647.  
  1648.  
  1649.             scterm();
  1650.           }
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.           scdcreate          scdcreate          _________
  1657.  
  1658.  
  1659.  
  1660.  
  1661.           Usage          Usage          _____
  1662.                     signed short int scdcreate( signed char *filename,                                     scdcreate                                                                                     ________ 
  1663.                                                 signed char numfields,                                                            _________ 
  1664.                                                 SC_FIELD fields[]);                                                         ______    
  1665.  
  1666.  
  1667.           Prototype in          Prototype in          ____________
  1668.                     dbase.h
  1669.  
  1670.  
  1671.           Description          Description          ___________
  1672.                     scdcreate creates a .DBF file. A pointer to an array of                    scdcreate                                              
  1673.                     SC_FIELD must be passed.
  1674.  
  1675.  
  1676.                     typedef struct {
  1677.                       signed char name[11];  /* field name */
  1678.                       signed char type;      /* field type */
  1679.                       unsigned char len;     /* field length */
  1680.                       unsigned char decpl;   /* decimal places */
  1681.                     } SC_FIELD;                      SC_FIELD 
  1682.  
  1683.  
  1684.                     The field  description array  must be  initialized  and
  1685.                     each element  set  to  appropriate  values.  The  array
  1686.                     determines the  organization of a data record. The .DBF
  1687.                     file does not remain open upon exit of this function.
  1688.  
  1689.  
  1690.                     This function  will create  a new .DBF file even if one
  1691.                     had already existed.
  1692.  
  1693.  
  1694.                     Field names  and types  are converted to all upper case
  1695.                     when the file is created.
  1696.  
  1697.  
  1698.                     Restrictions:
  1699.                     maximum record length is 4000 bytes.
  1700.                     maximum number of fields is 128.
  1701.                     maximum length of character fields is 254.
  1702.                     maximum length of numeric fields is 19 this includes
  1703.  
  1704.  
  1705.                                 Chapter 6, The SoftC Database Library    29                                                                         29
  1706.  
  1707.  
  1708.                     the decimal point and the sign .
  1709.                     length of date field is forced to 8.
  1710.                     length of logical fields is forced to 1.
  1711.                     the decimal places will be forced to zero for all types
  1712.                     except NUMERIC in which case it must be less then 'len'
  1713.                     - 2.
  1714.  
  1715.  
  1716.           Return Value          Return Value          ____________
  1717.                     SC_SUCCESS     .DBF file created
  1718.                     SC_WRTFAIL     disk write failure
  1719.                     SC_BADFLD      user supplied field description bad
  1720.                     SC_NOHNDL      no DOS file handles available
  1721.                     SC_NULLPARM    parameter address null
  1722.                     SC_MEMOFLD     memo fields are not fully supported
  1723.  
  1724.  
  1725.           Example          Example          _______
  1726.  
  1727.           #include "SoftC.h"
  1728.           
  1729.           
  1730.           void main()
  1731.           {
  1732.             SC_FIELD fields[4] = {
  1733.               "character",'c',16,0,     /* character field */
  1734.               "date",'d',8,0,           /* date field */
  1735.               "logical",'l',1,0,        /* logical field */
  1736.               "numeric",'n',6,2         /* numeric field */
  1737.             };
  1738.           
  1739.             scinit(20);
  1740.             scdcreate("TEST.DBF",4,fields);
  1741.             scterm();
  1742.           }
  1743.  
  1744.  
  1745.  
  1746.  
  1747.  
  1748.           scdfget          scdfget          _______
  1749.  
  1750.  
  1751.  
  1752.  
  1753.           Usage          Usage          _____
  1754.                     signed short int scdfget( signed char handle,                                     scdfget                                                                               ______ 
  1755.                                               signed char fieldno,                                                          _______ 
  1756.                                               void *data );                                                    ____   
  1757.  
  1758.  
  1759.           Prototype in          Prototype in          ____________
  1760.                     dbase.h
  1761.  
  1762.  
  1763.           30    Chapter 6, The SoftC Database Library          30                                         
  1764.  
  1765.  
  1766.           Description          Description          ___________
  1767.                     scdfget gets  data from  the desired field (fieldno) of                    scdfget                                                                                                                _______    
  1768.                     the input  buffer. data will be converted from DBaseIII
  1769.                     to a more natural data type for 'c':
  1770.  
  1771.  
  1772.                     DBaseIII field type      returned data type
  1773.                          'C'                      signed char *
  1774.                          'D'                      signed char [9]
  1775.                          'L'                      signed char
  1776.                          'N'                      double
  1777.  
  1778.  
  1779.                     scdfinfo can  be used  to determine  the length  of the                    scdfinfo                                               
  1780.                     longest data field in the file.
  1781.  
  1782.  
  1783.                     Note that  date fields  are returned as NULL terminated
  1784.                     character  strings   in  the   form:  "mm/dd/yy",   and
  1785.                     character  fields   are  returned  as  NULL  terminated
  1786.                     character strings.
  1787.  
  1788.  
  1789.           See also          See also          ________
  1790.                     scdfgets,  scdfput, scdfinfo, scdrget.                    scdfgets   scdfput  scdfinfo  scdrget 
  1791.  
  1792.  
  1793.           Return Value          Return Value          ____________
  1794.                     SC_SUCCESS     retrieved data from field
  1795.                     SC_BADHNDL     .DBF file not open or bad handle
  1796.                     SC_BADFLD      invalid data record field number
  1797.                     SC_NULLPARM    parameter address null
  1798.                     SC_MEMOFLD     memo fields are not fully supported
  1799.  
  1800.  
  1801.           Example          Example          _______
  1802.  
  1803.           #include "SoftC.h"
  1804.           
  1805.           
  1806.           
  1807.           void main()
  1808.           {
  1809.             char dbf, character[17],logical,date[9];
  1810.             double numeric;
  1811.           
  1812.             scinit(20);
  1813.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  1814.               scdrget(dbf,1L);
  1815.               scdfgets(dbf,0,character);
  1816.               scdfget(dbf,1,(void *) date);
  1817.               scdfget(dbf,2,(void *) &logical);
  1818.               scdfget(dbf,3,(void *) &numeric);
  1819.               printf("%s %s %c %lf\n",
  1820.  
  1821.  
  1822.                                 Chapter 6, The SoftC Database Library    31                                                                         31
  1823.  
  1824.  
  1825.                 character,date,logical,numeric);
  1826.               scdclose(dbf);
  1827.             }
  1828.             scterm();
  1829.           }
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.           scdfgets          scdfgets          ________
  1836.  
  1837.  
  1838.  
  1839.  
  1840.           Usage          Usage          _____
  1841.                     signed short int scdfgets( signed char handle,                                     scdfgets                                                                                _______
  1842.                                                signed char fieldno,                                                           _______ 
  1843.                                                char *data );                                                     ____   
  1844.  
  1845.  
  1846.           Prototype in          Prototype in          ____________
  1847.                     dbase.h
  1848.  
  1849.  
  1850.           Description          Description          ___________
  1851.                     scdfgets gets  data from the desired field (fieldno) of                    scdfgets                                                                                                               _______    
  1852.                     the input  buffer. data  will be  returned as an ASCIIZ                                       ____                                
  1853.                     string.
  1854.  
  1855.  
  1856.                     scdfinfo can  be used  to determine  the length  of the                    scdfinfo                                               
  1857.                     longest data field in the file.
  1858.  
  1859.  
  1860.                     Note  that   date  fields  are  returned  in  the  form
  1861.                     "yyyymmdd". There  is a  difference  between  the  date
  1862.                     formats of scdfgets and scdfget.                               scdfgets     scdfget 
  1863.  
  1864.  
  1865.           See also          See also          ________
  1866.                     scdfget,  scdfputs, scdfinfo, scdrget.                    scdfget   scdfputs  scdfinfo  scdrget 
  1867.  
  1868.  
  1869.           Return Value          Return Value          ____________
  1870.                     SC_SUCCESS     retrieved data from field
  1871.                     SC_BADHNDL     .DBF file not open or bad handle
  1872.                     SC_BADFLD      invalid data record field number
  1873.                     SC_NULLPARM    parameter address null
  1874.                     SC_MEMOFLD     memo fields are not fully supported
  1875.  
  1876.  
  1877.           32    Chapter 6, The SoftC Database Library          32                                         
  1878.  
  1879.  
  1880.           Example          Example          _______
  1881.  
  1882.           #include "SoftC.h"
  1883.           
  1884.           
  1885.           
  1886.           void main()
  1887.           {
  1888.             char dbf, character[17], logical, date[9];
  1889.             double numeric;
  1890.           
  1891.             scinit(20);
  1892.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  1893.               scdrget(dbf,1L);
  1894.               scdfgets(dbf,0,character);
  1895.               scdfgets(dbf,1,date);
  1896.               scdfget(dbf,2,(void *) &logical);
  1897.               scdfget(dbf,3,(void *) &numeric);
  1898.               printf("%s %s %c %lf\n",
  1899.                 character,date,logical,numeric);
  1900.               scdclose(dbf);
  1901.             }
  1902.             scterm();
  1903.           }
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.           scdfinfo          scdfinfo          ________
  1910.  
  1911.  
  1912.  
  1913.  
  1914.           Usage          Usage          _____
  1915.                     signed short int scdfinfo( signed char handle,                                     scdfinfo                                                                                ______ 
  1916.                                                signed char *longfldlen,                                                            __________ 
  1917.                                                SC_FIELD *fields );                                                         ______   
  1918.  
  1919.  
  1920.           Prototype in          Prototype in          ____________
  1921.                     dbase.h
  1922.  
  1923.  
  1924.           Description          Description          ___________
  1925.                     scdfinfo copies  the .DBF  field descriptions to fields                    scdfinfo                                                                                                                    ______
  1926.                     using the structure SC_FIELD. The length of the longest                                        SC_FIELD                           
  1927.                     data field is also returned (longfldlen).                                                 __________  
  1928.  
  1929.  
  1930.                     typedef struct {
  1931.                       signed char name[11];  /* field name */
  1932.                       signed char type;      /* field type */
  1933.                       unsigned char len;     /* field length */
  1934.  
  1935.  
  1936.                                 Chapter 6, The SoftC Database Library    33                                                                         33
  1937.  
  1938.  
  1939.                       unsigned char decpl;   /* decimal places */
  1940.                     } SC_FIELD;                      SC_FIELD 
  1941.  
  1942.  
  1943.                     The user  must ensure that the array defined for fields
  1944.                     is large  enough to  hold all of the field descriptions
  1945.                     because scdfinfo  blindly copies  the  descriptions  to                            scdfinfo                                       
  1946.                     fields. Severe  program errors can be the result if the
  1947.                     field array is too small. Use scdrinfo to determine the                                                  scdrinfo                 
  1948.                     number of fields in the data record.
  1949.  
  1950.  
  1951.           See also          See also          ________
  1952.                     scdrinfo                    scdrinfo
  1953.  
  1954.  
  1955.           Return Value          Return Value          ____________
  1956.                     SC_SUCCESS     returned the field descriptions
  1957.                     SC_BADHNDL     .DBF file not open or bad handle
  1958.                     SC_NULLPARM    parameter address null
  1959.  
  1960.  
  1961.           Example          Example          _______
  1962.  
  1963.           #include "SoftC.h"
  1964.           
  1965.           
  1966.           
  1967.           void main()
  1968.           {
  1969.             char dbf, longfld, numflds, a;
  1970.             SC_FIELD fields[128];  /* dBaseIII max size */
  1971.             short reclen;
  1972.             void *ibfr, *obfr;
  1973.           
  1974.             scinit(20);
  1975.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  1976.               scdrinfo(dbf,&reclen,&numflds,&ibfr,&obfr);
  1977.               scdfinfo(dbf,&longfld,fields);
  1978.               printf("longest field length = %d\n",longfld);
  1979.               for (a = 0; a < numflds; a++)
  1980.                 printf("%s %c %d %d\n", fields[a].name, fields[a].type,
  1981.                     fields[a].len, fields[a].decpl);
  1982.               scdclose(dbf);
  1983.             }
  1984.             scterm();
  1985.           }
  1986.  
  1987.  
  1988.           34    Chapter 6, The SoftC Database Library          34                                         
  1989.  
  1990.  
  1991.           scdfnam2no          scdfnam2no          __________
  1992.  
  1993.  
  1994.  
  1995.  
  1996.           Usage          Usage          _____
  1997.                     signed short int scdfnam2no( signed char handle,                                     scdfnam2no                                                                                  ______ 
  1998.                                                  signed char *fieldname,                                                              _________ 
  1999.                                                  signed char *fieldno );                                                              _______   
  2000.  
  2001.  
  2002.           Prototype in          Prototype in          ____________
  2003.                     dbase.h
  2004.  
  2005.  
  2006.           Description          Description          ___________
  2007.                     scdfnam2no searches through the field description array                    scdfnam2no                                             
  2008.                     for .DBF  file handle  looking for  fieldname. It  will                                   ______               _________          
  2009.                     return the corresponding field number.
  2010.  
  2011.  
  2012.                     Note that  .DBF files  created by SoftC will have field
  2013.                     names changed to all upper case.
  2014.  
  2015.  
  2016.           Return Value          Return Value          ____________
  2017.                     SC_SUCCESS     field number returned
  2018.                     SC_BADHNDL     .DBF file not open or bad handle
  2019.                     SC_BADFLD      invalid data record field name
  2020.                     SC_NULLPARM    parameter address null
  2021.  
  2022.  
  2023.           Example          Example          _______
  2024.  
  2025.           #include "SoftC.h"
  2026.           
  2027.           
  2028.           
  2029.           void main()
  2030.           {
  2031.             char dbf, fldno
  2032.           
  2033.             scinit(20);
  2034.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  2035.               scdfnam2no(dbf,"LOGICAL",&fldno);
  2036.               printf("%d",fldno);
  2037.               scdclose(dbf);
  2038.             }
  2039.             scterm();
  2040.           }
  2041.  
  2042.  
  2043.                                 Chapter 6, The SoftC Database Library    35                                                                         35
  2044.  
  2045.  
  2046.           scdfput          scdfput          _______
  2047.  
  2048.  
  2049.  
  2050.  
  2051.           Usage          Usage          _____
  2052.                     signed short int scdfput( signed char handle,                                     scdfput                                                                               ______ 
  2053.                                               signed char fieldno,                                                          _______ 
  2054.                                               void *data );                                                    ____   
  2055.  
  2056.  
  2057.           Prototype in          Prototype in          ____________
  2058.                     dbase.h
  2059.  
  2060.  
  2061.           Description          Description          ___________
  2062.                     scdfput will  convert data  from 'c' format to dBaseIII                    scdfput                                                                                          ____                             
  2063.                     format and  place it  in the  proper field (fieldno) of                                                                _______    
  2064.                     the output buffer.
  2065.  
  2066.  
  2067.                     Field numbers  begin with  zero (0).  If the  field  is
  2068.                     numeric, data should be passed as a double.                             ____                              
  2069.  
  2070.  
  2071.                     Note that  scdfput follows the date formatting standard                               scdfput                                     
  2072.                     of scdfget.  It is  optional to  include the  "19" from                       scdfget                                             
  2073.                     "1989" as  this is  assumed, however  the date "2/1/00"
  2074.                     will become  "19000201" even  if you had intended it to
  2075.                     be  "20000201".   Date  strings  can  be  formatted  as
  2076.                     "2/1/2000" to overcome this problem.
  2077.  
  2078.  
  2079.           See also          See also          ________
  2080.                     scdfget, scdfputs.                    scdfget  scdfputs 
  2081.  
  2082.  
  2083.           Return Value          Return Value          ____________
  2084.                     SC_SUCCESS     data placed in field
  2085.                     SC_BADHNDL     .DBF file not open or bad handle
  2086.                     SC_BADFLD      invalid data record field number
  2087.                     SC_NULLPARM    parameter address null
  2088.                     SC_BADDATE     invalid date field
  2089.                     SC_FLDTRUNC    character field truncated
  2090.  
  2091.  
  2092.           Example          Example          _______
  2093.  
  2094.           #include "SoftC.h"
  2095.           
  2096.           
  2097.           
  2098.           void main()
  2099.           {
  2100.  
  2101.  
  2102.           36    Chapter 6, The SoftC Database Library          36                                         
  2103.  
  2104.  
  2105.             char dbf, logical = 'T', date[9] = "12/25/88";
  2106.             long recno;
  2107.             double numeric = 20.0L;
  2108.           
  2109.             scinit(20);
  2110.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  2111.               scdfputs(dbf,0,"SoftC Library   ");
  2112.               scdfput(dbf,1,(void *) date);
  2113.               scdfput(dbf,2,(void *) &logical);
  2114.               scdfput(dbf,3,(void *) &numeric);
  2115.               scdrput(dbf,SC_ADD,&recno);
  2116.               printf("Record number = %ld\n",recno);
  2117.               scdclose(dbf);
  2118.             }
  2119.             scterm();
  2120.           }
  2121.  
  2122.  
  2123.  
  2124.  
  2125.  
  2126.           scdfputs          scdfputs          ________
  2127.  
  2128.  
  2129.  
  2130.  
  2131.           Usage          Usage          _____
  2132.                     signed short int scdfputs( signed char handle,                                     scdfputs                                                                                ______ 
  2133.                                                signed char fieldno,                                                           _______ 
  2134.                                                char *data );                                                     ____   
  2135.  
  2136.  
  2137.           Prototype in          Prototype in          ____________
  2138.                     dbase.h
  2139.  
  2140.  
  2141.           Description          Description          ___________
  2142.                     scdfputs will  place data in the proper field (fieldno)                    scdfputs                                                                                        ____                      _______ 
  2143.                     of the  output buffer.  It is the user's responsibility
  2144.                     to provide a properly sized and formatted ASCIIZ string
  2145.                     to scdfputs.                       scdfputs 
  2146.  
  2147.  
  2148.                     Field numbers  begin with  zero (0).  If the  field  is
  2149.                     numeric, data should be passed as a double.                             ____                              
  2150.  
  2151.  
  2152.                     Note  that   scdfputs  follows   the  date   formatting                                 scdfputs                                  
  2153.                     conventions of  scdfgets. Also  be aware  that the date                                    scdfgets                               
  2154.                     formatting conventions  of scdfget/scdfput  are not the                                               scdfget scdfput             
  2155.                     same as scdfgets/scdfputs.                            scdfgets scdfputs 
  2156.  
  2157.  
  2158.                                 Chapter 6, The SoftC Database Library    37                                                                         37
  2159.  
  2160.  
  2161.           See also          See also          ________
  2162.                     scdfgets, scdfput.                    scdfgets  scdfput 
  2163.  
  2164.  
  2165.           Return Value          Return Value          ____________
  2166.                     SC_SUCCESS     data placed in field
  2167.                     SC_BADHNDL     .DBF file not open or bad handle
  2168.                     SC_BADFLD      invalid data record field number
  2169.                     SC_NULLPARM    parameter address null
  2170.                     SC_BADDATE     invalid date field
  2171.                     SC_FLDTRUNC    character field truncated
  2172.  
  2173.  
  2174.           Example          Example          _______
  2175.  
  2176.           #include "SoftC.h"
  2177.           
  2178.           
  2179.           
  2180.           void main()
  2181.           {
  2182.             char dbf, logical,date[9];
  2183.             long recno;
  2184.             double numeric;
  2185.           
  2186.             scinit(20);
  2187.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  2188.               scdfputs(dbf,0,"SoftC Library   ");
  2189.               scdfputs(dbf,1, date);
  2190.               scdfput(dbf,2,(void *) &logical);
  2191.               scdfput(dbf,3,(void *) &numeric);
  2192.               scdrput(dbf,SC_ADD,&recno);
  2193.               printf("Record number = %ld\n",recno);
  2194.               scdclose(dbf);
  2195.             }
  2196.             scterm();
  2197.           }
  2198.  
  2199.  
  2200.  
  2201.  
  2202.  
  2203.           scdinfo          scdinfo          _______
  2204.  
  2205.  
  2206.  
  2207.  
  2208.           Usage          Usage          _____
  2209.                     signed short int scdinfo( signed char handle,                                     scdinfo                                                                               ______ 
  2210.                                               signed char *filename );                                                           ________   
  2211.  
  2212.  
  2213.           Prototype in          Prototype in          ____________
  2214.                     dbase.h
  2215.  
  2216.  
  2217.           38    Chapter 6, The SoftC Database Library          38                                         
  2218.  
  2219.  
  2220.           Description          Description          ___________
  2221.                     scdinfo gets  the name  of  the  file  associated  with                    scdinfo                                                
  2222.                     handle.                    ______ 
  2223.  
  2224.  
  2225.           See also          See also          ________
  2226.                     scdopen                    scdopen
  2227.  
  2228.  
  2229.           Return Value          Return Value          ____________
  2230.                     SC_SUCCESS     returned the file name
  2231.                     SC_BADHNDL     .DBF file not open or bad handle
  2232.                     SC_NULLPARM    parameter address null
  2233.  
  2234.  
  2235.           Example          Example          _______
  2236.  
  2237.           #include <dir.h>
  2238.           #include "SoftC.h"
  2239.           
  2240.           
  2241.           
  2242.           void main()
  2243.           {
  2244.             char dbf;
  2245.             char filename[MAXPATH];
  2246.           
  2247.             scinit(20);
  2248.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  2249.               scdinfo(dbf,filename);
  2250.               printf("%s",filename);
  2251.               scdclose(dbf);
  2252.             }
  2253.             scterm();
  2254.           }
  2255.  
  2256.  
  2257.  
  2258.  
  2259.  
  2260.           scdopen          scdopen          _______
  2261.  
  2262.  
  2263.  
  2264.  
  2265.           Usage          Usage          _____
  2266.                     signed short int scdopen( signed char *handle,                                     scdopen                                                                                 ______ 
  2267.                                               signed char *filename );                                                           ________   
  2268.  
  2269.  
  2270.           Prototype in          Prototype in          ____________
  2271.                     dbase.h
  2272.  
  2273.  
  2274.                                 Chapter 6, The SoftC Database Library    39                                                                         39
  2275.  
  2276.  
  2277.           Description          Description          ___________
  2278.                     scdopen opens a .DBF file. Memory will be allocated for                    scdopen                                                
  2279.                     a file packet and I/O buffers for use internally by the
  2280.                     SoftC file manager.
  2281.  
  2282.  
  2283.           Return Value          Return Value          ____________
  2284.                     SC_SUCCESS     file opened and memory allocated
  2285.                     SC_MEMERR      memory allocation failure
  2286.                     SC_NOFILE      .DBF file not found
  2287.                     SC_RDFAIL      disk read failure
  2288.                     SC_NODBF       file not in .DBF format
  2289.                     SC_SKFAIL      disk seek failure
  2290.                     SC_NOHNDL      no SoftC file handles available
  2291.                     SC_BADFNAME    invalid filename
  2292.                     SC_NULLPARM    parameter address null
  2293.                     SC_DBFVERS     invalid dBase version
  2294.                     SC_DBFHLEN     header length error
  2295.                     SC_DBFDATE     last update date in error
  2296.  
  2297.  
  2298.           Example          Example          _______
  2299.  
  2300.           #include "SoftC.h"
  2301.           
  2302.           
  2303.           void main()
  2304.           {
  2305.             char dbf;
  2306.           
  2307.             scinit(20);
  2308.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS)
  2309.               scdclose(dbf);
  2310.           
  2311.             scterm();
  2312.           }
  2313.  
  2314.  
  2315.  
  2316.  
  2317.  
  2318.           scdrclear          scdrclear          _________
  2319.  
  2320.  
  2321.  
  2322.  
  2323.           Usage          Usage          _____
  2324.                     signed short int scdrclear( signed char handle,                                     scdrclear                                                                                 ______ 
  2325.                                                 signed short int buffer );                                                                 ______   
  2326.  
  2327.  
  2328.           Prototype in          Prototype in          ____________
  2329.                     dbase.h
  2330.  
  2331.  
  2332.           40    Chapter 6, The SoftC Database Library          40                                         
  2333.  
  2334.  
  2335.           Description          Description          ___________
  2336.                     scdrclear clears  a .DBF  I/O buffer.  buffer indicates                    scdrclear                                                                                                         ______          
  2337.                     which record buffer to clear.
  2338.  
  2339.  
  2340.                     buffer =       clears this buffer
  2341.                     SC_INPUT            input
  2342.                     SC_OUTPUT           output
  2343.  
  2344.  
  2345.           Return Value          Return Value          ____________
  2346.                     SC_SUCCESS     buffer cleared
  2347.                     SC_BADHNDL     .DBF file not open or bad handle
  2348.                     SC_BADCMD      invalid buffer
  2349.  
  2350.  
  2351.           Example          Example          _______
  2352.  
  2353.           #include "SoftC.h"
  2354.           
  2355.           
  2356.           
  2357.           void main()
  2358.           {
  2359.             char dbf, character[17] = "Hello World!";
  2360.           
  2361.             scinit(20);
  2362.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  2363.               scdfputs(dbf,0,"SoftC Library   ");
  2364.               scdrclear(dbf,SC_INPUT);
  2365.               scdrcopy(dbf,SC_OUTPUT);
  2366.               scdfgets(dbf,0,character);
  2367.               printf("%s\n",character);
  2368.             }
  2369.             scterm();
  2370.           }
  2371.  
  2372.  
  2373.  
  2374.  
  2375.  
  2376.           scdrcopy          scdrcopy          ________
  2377.  
  2378.  
  2379.  
  2380.  
  2381.           Usage          Usage          _____
  2382.                     signed short int scdrcopy( signed char handle,                                     scdrcopy                                                                                ______ 
  2383.                                                signed short int buffer );                                                                ______   
  2384.  
  2385.  
  2386.           Prototype in          Prototype in          ____________
  2387.                     dbase.h
  2388.  
  2389.  
  2390.                                 Chapter 6, The SoftC Database Library    41                                                                         41
  2391.  
  2392.  
  2393.           Description          Description          ___________
  2394.                     scdrcopy copies  the contents  of one I/O buffer to the                    scdrcopy                                               
  2395.                     other. buffer indicates the direction of the copy.                           ______                                     
  2396.  
  2397.  
  2398.                     buffer =       copies this way
  2399.                     SC_INPUT            input to output
  2400.                     SC_OUTPUT           output to input
  2401.  
  2402.  
  2403.           Return Value          Return Value          ____________
  2404.                     SC_SUCCESS     buffer copy
  2405.                     SC_BADHNDL     .DBF file not open or bad handle
  2406.                     SC_BADCMD      invalid buffer
  2407.  
  2408.  
  2409.           Example          Example          _______
  2410.  
  2411.           #include "SoftC.h"
  2412.           
  2413.           
  2414.           
  2415.           void main()
  2416.           {
  2417.             char dbf, character[17] = "Hello World!";
  2418.           
  2419.             scinit(20);
  2420.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  2421.               scdfputs(dbf,0,"SoftC Library   ");
  2422.               scdrclear(dbf,SC_INPUT);
  2423.               scdrcopy(dbf,SC_OUTPUT);
  2424.               scdfgets(dbf,0,character);
  2425.               printf("%s\n",character);
  2426.               scdclose(dbf);
  2427.             }
  2428.             scterm();
  2429.           }
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.           scdrdel          scdrdel          _______
  2436.  
  2437.  
  2438.  
  2439.  
  2440.           Usage          Usage          _____
  2441.                     signed short int scdrdel( signed char handle,                                     scdrdel                                                                               ______ 
  2442.                                               signed long int recno );                                                              _____   
  2443.  
  2444.  
  2445.           Prototype in          Prototype in          ____________
  2446.                     dbase.h
  2447.  
  2448.  
  2449.           42    Chapter 6, The SoftC Database Library          42                                         
  2450.  
  2451.  
  2452.           Description          Description          ___________
  2453.                     scdrdel will  flag  a  record  specified  by  recno  as                    scdrdel                                                                                                                  _____    
  2454.                     'deleted'. To  maintain compatibility with dBaseIII the
  2455.                     data record cannot be reused, but it can be 'undeleted'
  2456.                     by scdrundel.                       scdrundel 
  2457.  
  2458.  
  2459.           See also          See also          ________
  2460.                     scdrundel.                    scdrundel 
  2461.  
  2462.  
  2463.           Return Value          Return Value          ____________
  2464.                     SC_SUCCESS     record marked 'deleted'
  2465.                     SC_BADHNDL     .DBF file not open or bad handle
  2466.                     SC_SKFAIL      invalid data record number or disk seek
  2467.                                    failure
  2468.                     SC_RDFAIL      disk read failure
  2469.                     SC_WRTFAIL     disk write failure
  2470.  
  2471.  
  2472.           Example          Example          _______
  2473.  
  2474.           #include "SoftC.h"
  2475.           
  2476.           
  2477.           
  2478.           void main()
  2479.           {
  2480.             char dbf;
  2481.           
  2482.             scinit(20);
  2483.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  2484.               scdrdel(dbf,1L);
  2485.               scdrget(dbf,1L);
  2486.               printf("%s\n",scemsg());
  2487.               scdclose(dbf);
  2488.             }
  2489.             scterm();
  2490.           }
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.           scdrget          scdrget          _______
  2497.  
  2498.  
  2499.  
  2500.  
  2501.           Usage          Usage          _____
  2502.                     signed short int scdrget( signed char handle,                                     scdrget                                                                               ______ 
  2503.                                               signed long int recno );                                                              _____   
  2504.  
  2505.  
  2506.                                 Chapter 6, The SoftC Database Library    43                                                                         43
  2507.  
  2508.  
  2509.           Prototype in          Prototype in          ____________
  2510.                     dbase.h
  2511.  
  2512.  
  2513.           Description          Description          ___________
  2514.                     scdrget will  read the  data record  specified by recno                    scdrget                                                                                                                      _____
  2515.                     from the  .DBF file  associated with  handle  into  the
  2516.                     internal input buffer.
  2517.  
  2518.  
  2519.           See also          See also          ________
  2520.                     scdfget, scdfputs, scdrget.                    scdfget  scdfputs  scdrget 
  2521.  
  2522.  
  2523.           Return Value          Return Value          ____________
  2524.                     SC_SUCCESS     record read
  2525.                     SC_BADHNDL     .DBF file not open or bad handle
  2526.                     SC_SKFAIL      invalid data record number or disk seek
  2527.                                    failure
  2528.                     SC_RDFAIL      disk read failure
  2529.                     SC_DELREC      record read was marked 'deleted'
  2530.  
  2531.  
  2532.           Example          Example          _______
  2533.  
  2534.           #include "SoftC.h"
  2535.           
  2536.           
  2537.           
  2538.           void main()
  2539.           {
  2540.             char dbf, character[17] = "Hello",
  2541.                  logical = 'F', date[9] = "12/25/88";
  2542.             double numeric = 150.00L;
  2543.           
  2544.             scinit(20);
  2545.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  2546.               scdrget(dbf,1L);
  2547.               scdfgets(dbf,0,character);
  2548.               scdfgets(dbf,1,date);
  2549.               scdfget(dbf,2,(void *) &logical);
  2550.               scdfget(dbf,3,(void *) &numeric);
  2551.               printf("%s %s %c %lf\n",
  2552.                 character,date,logical,numeric);
  2553.               scdclose(dbf);
  2554.             }
  2555.             scterm();
  2556.           }
  2557.  
  2558.  
  2559.           44    Chapter 6, The SoftC Database Library          44                                         
  2560.  
  2561.  
  2562.           scdrinfo          scdrinfo          ________
  2563.  
  2564.  
  2565.  
  2566.  
  2567.           Usage          Usage          _____
  2568.                     signed short int scdrinfo( signed char handle,                                     scdrinfo                                                                                ______ 
  2569.                                                signed short int *reclen,                                                                 ______ 
  2570.                                                signed char *numflds,                                                            _______ 
  2571.                                                void **ibfr,                                                      ____ 
  2572.                                                void **obfr );                                                      ____   
  2573.  
  2574.  
  2575.           Prototype in          Prototype in          ____________
  2576.                     dbase.h
  2577.  
  2578.  
  2579.           Description          Description          ___________
  2580.                     scdrinfo gets  the data  record  length  (reclen),  the                    scdrinfo                                                                                                             ______       
  2581.                     number of  data fields  per record  (numflds), and  the                                                         _______           
  2582.                     addresses  of   the  input  (ibfr)  and  output  (obfr)                                                 ____                 ____ 
  2583.                     buffers.
  2584.  
  2585.  
  2586.           Return Value          Return Value          ____________
  2587.                     SC_SUCCESS     requested information returned
  2588.                     SC_BADHNDL     .DBF file not open or bad handle
  2589.                     SC_NULLPARM    parameter address null
  2590.  
  2591.  
  2592.           Example          Example          _______
  2593.  
  2594.           #include "SoftC.h"
  2595.           
  2596.           
  2597.           
  2598.           void main()
  2599.           {
  2600.             char dbf, numflds;
  2601.             short reclen;
  2602.             void *ibfr, *obfr;
  2603.           
  2604.             scinit(20);
  2605.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  2606.               scdrinfo(dbf,&reclen,&numflds,&ibfr,&obfr);
  2607.               printf("Record length = %d\n",reclen);
  2608.               printf("Number of fields = %d\n",numflds);
  2609.               printf("I/O buffers = %p %p\n",ibfr,obfr);
  2610.               scdclose(dbf);
  2611.             }
  2612.             scterm();
  2613.           }
  2614.  
  2615.  
  2616.                                 Chapter 6, The SoftC Database Library    45                                                                         45
  2617.  
  2618.  
  2619.           scdrput          scdrput          _______
  2620.  
  2621.  
  2622.  
  2623.  
  2624.           Usage          Usage          _____
  2625.                     signed short int scdrput( signed char handle,                                     scdrput                                                                               ______ 
  2626.                                               signed short int howto,                                                               _____ 
  2627.                                               signed long int *recno );                                                               _____   
  2628.  
  2629.  
  2630.           Prototype in          Prototype in          ____________
  2631.                     dbase.h
  2632.  
  2633.  
  2634.           Description          Description          ___________
  2635.                     scdrput will  write the  data record specified by recno                    scdrput                                                                                                                      _____
  2636.                     to the  .DBF  file  associated  with  handle  from  the                                                          ______           
  2637.                     internal output  buffer. howto  determines how the data                                             _____                         
  2638.                     record is to be written:
  2639.  
  2640.  
  2641.                     howto =        action
  2642.                     SC_ADD           record appended to end of file
  2643.                     SC_UPDATE        current record updated
  2644.  
  2645.  
  2646.                     If a  record update is occurring the data record number
  2647.                     associated with  the record in the input buffer will be
  2648.                     returned. An  update will not be performed if the input
  2649.                     buffer is  empty. Use  scdrget to load a data record or                                           scdrget                         
  2650.                     scdfput or  scdfputs to  fill the  data record field by                    scdfput     scdfputs                                   
  2651.                     field.
  2652.  
  2653.  
  2654.           See also          See also          ________
  2655.                     scdfput, scdfputs, scdrget.                    scdfput  scdfputs  scdrget 
  2656.  
  2657.  
  2658.           Return Value          Return Value          ____________
  2659.                     SC_SUCCESS     record read
  2660.                     SC_BADHNDL     .DBF file not open or bad handle
  2661.                     SC_SKFAIL      invalid data record number or disk seek
  2662.                                    failure
  2663.                     SC_WRTFAIL     disk write failure
  2664.                     SC_BADCMD      invalid record write command
  2665.                     SC_NULLPARM    parameter address null
  2666.  
  2667.  
  2668.           Example          Example          _______
  2669.  
  2670.           #include "SoftC.h"
  2671.           
  2672.           
  2673.  
  2674.  
  2675.           46    Chapter 6, The SoftC Database Library          46                                         
  2676.  
  2677.  
  2678.           
  2679.           void main()
  2680.           {
  2681.             char dbf, logical = 'T', date[9] = "19881225";
  2682.             long recno;
  2683.             double numeric = 20.0L;
  2684.           
  2685.             scinit(20);
  2686.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  2687.               scdfputs(dbf,0,"SoftC Library   ");
  2688.               scdfput(dbf,1,(void *) date);
  2689.               scdfput(dbf,2,(void *) &logical);
  2690.               scdfput(dbf,3,(void *) &numeric);
  2691.               scdrput(dbf,SC_ADD,&recno);
  2692.               printf("Record number = %ld\n",recno);
  2693.               scdclose(dbf);
  2694.             }
  2695.             scterm();
  2696.           }
  2697.  
  2698.  
  2699.  
  2700.  
  2701.  
  2702.           scdrundel          scdrundel          _________
  2703.  
  2704.  
  2705.  
  2706.  
  2707.           Usage          Usage          _____
  2708.                     signed short int scdrundel( signed char handle,                                     scdrundel                                                                                 ______ 
  2709.                                                 signed long int recno );                                                                _____   
  2710.  
  2711.  
  2712.           Prototype in          Prototype in          ____________
  2713.                     dbase.h
  2714.  
  2715.  
  2716.           Description          Description          ___________
  2717.                     scdrundel will  remove the 'deleted' flag from the data                    scdrundel                                              
  2718.                     record specified by recno.                                        _____ 
  2719.  
  2720.  
  2721.           See also          See also          ________
  2722.                     scdrdel.                    scdrdel 
  2723.  
  2724.  
  2725.           Return Value          Return Value          ____________
  2726.                     SC_SUCCESS     record recovered
  2727.                     SC_BADHNDL     .DBF file not open or bad handle
  2728.                     SC_SKFAIL      invalid data record number or disk seek
  2729.                                    failure
  2730.                     SC_RDFAIL      disk read failure
  2731.                     SC_WRTFAIL     disk write failure
  2732.  
  2733.  
  2734.                                 Chapter 6, The SoftC Database Library    47                                                                         47
  2735.  
  2736.  
  2737.           Example          Example          _______
  2738.  
  2739.           #include "SoftC.h"
  2740.           
  2741.           
  2742.           
  2743.           void main()
  2744.           {
  2745.             char dbf;
  2746.             long recno;
  2747.           
  2748.             scinit(20);
  2749.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  2750.               scdrundel(dbf,1L);
  2751.               scdrget(dbf,1L);
  2752.               printf("%s\n",scemsg());
  2753.               scdclose(dbf);
  2754.             }
  2755.             scterm();
  2756.           }
  2757.  
  2758.  
  2759.  
  2760.  
  2761.  
  2762.           scdsize          scdsize          _______
  2763.  
  2764.  
  2765.  
  2766.  
  2767.           Usage          Usage          _____
  2768.                     signed short int scdsize( signed char handle,                                     scdsize                                                                               ______ 
  2769.                                               signed long int *recsused );                                                               ________   
  2770.  
  2771.  
  2772.           Prototype in          Prototype in          ____________
  2773.                     dbase.h
  2774.  
  2775.  
  2776.           Description          Description          ___________
  2777.                     scdsize gets the number of records in the .DBF file.                    scdsize                                             
  2778.  
  2779.  
  2780.           Return Value          Return Value          ____________
  2781.                     SC_SUCCESS     returned the number of records
  2782.                     SC_BADHNDL     .DBF file not open or bad handle
  2783.                     SC_NULLPARM    parameter address null
  2784.  
  2785.  
  2786.           Example          Example          _______
  2787.  
  2788.           #include "SoftC.h"
  2789.           
  2790.           
  2791.  
  2792.  
  2793.           48    Chapter 6, The SoftC Database Library          48                                         
  2794.  
  2795.  
  2796.           
  2797.           void main()
  2798.           {
  2799.             char dbf;
  2800.             long recsused;
  2801.           
  2802.             scinit(20);
  2803.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  2804.               scdsize(dbf,&recsused);
  2805.               printf("%ld",recsused);
  2806.               scdclose(dbf);
  2807.             }
  2808.             scterm();
  2809.           }
  2810.  
  2811.  
  2812.  
  2813.  
  2814.  
  2815.           sceclr          sceclr          ______
  2816.  
  2817.  
  2818.  
  2819.  
  2820.           Usage          Usage          _____
  2821.                     void sceclr( void );                         sceclr         
  2822.  
  2823.  
  2824.           Prototype in          Prototype in          ____________
  2825.                     SoftC.h
  2826.  
  2827.  
  2828.           Description          Description          ___________
  2829.                     sceclr  will   clear  the   SoftC  library  error  flag                    sceclr                                                 
  2830.                     (sc_code).                     sc_code  
  2831.  
  2832.  
  2833.           See also          See also          ________
  2834.                     scemsg.                    scemsg 
  2835.  
  2836.  
  2837.           Return Value          Return Value          ____________
  2838.                     None.
  2839.  
  2840.  
  2841.           Example          Example          _______
  2842.  
  2843.           #include "SoftC.h"
  2844.           
  2845.           
  2846.           void main()
  2847.           {
  2848.             scinit(20);
  2849.             sceclr();
  2850.  
  2851.  
  2852.                                 Chapter 6, The SoftC Database Library    49                                                                         49
  2853.  
  2854.  
  2855.             scterm();
  2856.           }
  2857.  
  2858.  
  2859.  
  2860.  
  2861.  
  2862.           scemsg          scemsg          ______
  2863.  
  2864.  
  2865.  
  2866.  
  2867.           Usage          Usage          _____
  2868.                     signed char * scemsg( void );                                  scemsg         
  2869.  
  2870.  
  2871.           Prototype in          Prototype in          ____________
  2872.                     SoftC.h
  2873.  
  2874.  
  2875.           Description          Description          ___________
  2876.                     scemsg gets  the  SoftC  library  error  message  which                    scemsg                                                 
  2877.                     corresponds to the last known error.
  2878.  
  2879.  
  2880.                     Warning Codes and Messages:
  2881.  
  2882.  
  2883.                     1    "WARNING - record read is marked deleted",
  2884.                     2    "WARNING - file is empty",
  2885.                     3    "WARNING - no more keys",
  2886.                     4    "WARNING - could not find key in index file",
  2887.                     5    "WARNING - data field truncated",
  2888.                     6    "WARNING - numeric field rounded",
  2889.                     7    "WARNING - memo fields not supported",
  2890.                     8    "WARNING - file length is incorrect"
  2891.  
  2892.  
  2893.                     Error Codes and Messages:
  2894.  
  2895.  
  2896.                     -1   "ERROR - file write failure",
  2897.                     -2   "ERROR - file read failure",
  2898.                     -3   "ERROR - memory allocation error",
  2899.                     -4   "ERROR - bad user specified field description",
  2900.                     -5   "ERROR - file not in .DBF format",
  2901.                     -6   "ERROR - file pointer reposition failed",
  2902.                     -7   "ERROR - file not found",
  2903.                     -8   "ERROR - file corrupted",
  2904.                     -9   "ERROR - bad user specified key expression",
  2905.                     -10  "ERROR - file not in .NDX format",
  2906.                     -11  "ERROR - no handles available",
  2907.                     -12  "ERROR - no index pages loaded",
  2908.                     -13  "ERROR - index page was not loaded",
  2909.  
  2910.  
  2911.           50    Chapter 6, The SoftC Database Library          50                                         
  2912.  
  2913.  
  2914.                     -14  "ERROR - file close failure",
  2915.                     -15  "ERROR - invalid command",
  2916.                     -16  "ERROR - invalid handle number",
  2917.                     -17  "ERROR - invalid filename",
  2918.                     -18  "ERROR - invalid date",
  2919.                     -19  "ERROR - invalid time",
  2920.                     -20  "ERROR - file not in .DBT format",
  2921.                     -21  "ERROR - invalid dBaseIII version",
  2922.                     -22  "ERROR - file header length error",
  2923.                     -23  "ERROR - last file change date in error",
  2924.                     -24  "ERROR - parameter address null",
  2925.                     -25  "ERROR - invalid key type",
  2926.                     -26  "ERROR - invalid key length",
  2927.                     -27  "ERROR - item length incorrect",
  2928.                     -28  "ERROR - invalid root page",
  2929.                     -29  "ERROR - bad maximum number of keys per page"
  2930.  
  2931.  
  2932.           See also          See also          ________
  2933.                     sceclr.                    sceclr 
  2934.  
  2935.  
  2936.           Return Value          Return Value          ____________
  2937.                     scemsg returns the error message.                    scemsg                           
  2938.  
  2939.  
  2940.           Example          Example          _______
  2941.  
  2942.           #include "SoftC.h"
  2943.           
  2944.           
  2945.           void main()
  2946.           {
  2947.             scinit(20);
  2948.             printf("%s",scemsg());
  2949.             scterm();
  2950.           }
  2951.  
  2952.  
  2953.  
  2954.  
  2955.  
  2956.           sciclose          sciclose          ________
  2957.  
  2958.  
  2959.  
  2960.  
  2961.           Usage          Usage          _____
  2962.                     signed short int sciclose( signed char handle );                                     sciclose                                                                                  ______   
  2963.  
  2964.  
  2965.           Prototype in          Prototype in          ____________
  2966.                     dbase.h
  2967.  
  2968.  
  2969.                                 Chapter 6, The SoftC Database Library    51                                                                         51
  2970.  
  2971.  
  2972.           Description          Description          ___________
  2973.                     sciclose closes  an .NDX  file and  frees all allocated                    sciclose                                               
  2974.                     memory associated with .NDX file.
  2975.  
  2976.  
  2977.           Return Value          Return Value          ____________
  2978.                     SC_SUCCESS     .NDX file closed
  2979.                     SC_CLOSFAIL    file close failure
  2980.                     SC_BADHNDL     .NDX file not open or bad handle
  2981.  
  2982.  
  2983.           Example          Example          _______
  2984.  
  2985.           #include "SoftC.h"
  2986.           
  2987.           
  2988.           void main()
  2989.           {
  2990.             char ndx;
  2991.           
  2992.             scinit(20);
  2993.             if (sciopen(&ndx,"TEST.NDX") == SC_SUCCESS)
  2994.               sciclose(ndx);
  2995.             scterm();
  2996.           }
  2997.  
  2998.  
  2999.  
  3000.  
  3001.  
  3002.           scicreate          scicreate          _________
  3003.  
  3004.  
  3005.  
  3006.  
  3007.           Usage          Usage          _____
  3008.                     signed short int scicreate( signed char *filename,                                     scicreate                                                                                     ________ 
  3009.                                                 signed char keytype,                                                            _______ 
  3010.                                                 signed char *keyexpr,                                                             _______ 
  3011.                                                 signed char keylen );                                                            ______   
  3012.  
  3013.  
  3014.           Prototype in          Prototype in          ____________
  3015.                     dbase.h
  3016.  
  3017.  
  3018.           Description          Description          ___________
  3019.                     scicreate  creates   an  .NDX  file.  keyexpr  will  be                    scicreate                                                                                                        _______          
  3020.                     translated to  all upper  case when  the index  file is
  3021.                     created.
  3022.  
  3023.  
  3024.                     If keytype  is 'c',  then keyexpr  must be  a character                       _______                _______                      
  3025.                     string consisting  of one  or more field names from the
  3026.  
  3027.  
  3028.           52    Chapter 6, The SoftC Database Library          52                                         
  3029.  
  3030.  
  3031.                     data record. All fields included in the expression must
  3032.                     be of type 'c' or be translated into type 'c'. No check
  3033.                     is made to verify this. keylen cannot exceed 100.                                            ______                   
  3034.  
  3035.  
  3036.                     If keytype  is 'n'  or 'd', then keyexpr should consist                       _______                       _______               
  3037.                     of only  one data  field. keylen  will automatically be                                              ______                       
  3038.                     set to 8 (numeric and date keys are stored as doubles).
  3039.  
  3040.  
  3041.                     NOTE: scicreate will create a new .NDX file even if one                          scicreate                                        
  3042.                     had already existed.
  3043.  
  3044.  
  3045.                     NOTE: keyexpr  is used  by  dBaseIII.  keyexpr  is  NOT                          _______                          _______         
  3046.                     checked for  validity by  the SoftC  data file manager.
  3047.                     Currently only the scikmake function uses keyexpr.                                       scikmake                                                                                     _______ 
  3048.  
  3049.  
  3050.           See also          See also          ________
  3051.                     scikmake.                    scikmake 
  3052.  
  3053.  
  3054.           Return Value          Return Value          ____________
  3055.                     SC_SUCCESS     .NDX file created
  3056.                     SC_WRTFAIL     disk write failure
  3057.                     SC_BADEXPR     invalid keytype or bad keyexpr
  3058.                     SC_NOHNDL      no DOS handles available
  3059.                     SC_NULLPARM    parameter address null
  3060.                     SC_BADKEYT     invalid key type
  3061.                     SC_KEYLEN      invalid key length
  3062.  
  3063.  
  3064.           Example          Example          _______
  3065.  
  3066.           #include "SoftC.h"
  3067.           
  3068.           
  3069.           void main()
  3070.           {
  3071.             scinit(20);
  3072.             scicreate("TEST.NDX",'d',"date",8);
  3073.             scterm();
  3074.           }
  3075.  
  3076.  
  3077.                                 Chapter 6, The SoftC Database Library    53                                                                         53
  3078.  
  3079.  
  3080.           sciexpr          sciexpr          _______
  3081.  
  3082.  
  3083.  
  3084.  
  3085.           Usage          Usage          _____
  3086.                     signed short int sciexpr( signed char handle,                                     sciexpr                                                                               ______ 
  3087.                                               signed char *keyexpr );                                                           _______   
  3088.  
  3089.  
  3090.           Prototype in          Prototype in          ____________
  3091.                     dbase.h
  3092.  
  3093.  
  3094.           Description          Description          ___________
  3095.                     sciexpr gets the index key expression and returns it as                    sciexpr                                                
  3096.                     a  character   string  into   a  user  supplied  buffer
  3097.                     (keyexpr). The  user must  ensure that  the  buffer  is                     _______                                               
  3098.                     large  enough   (the  key   expression  length  can  be
  3099.                     determined via  a call  to sciinfo)  to hold the entire                                               sciinfo                     
  3100.                     key expression.
  3101.  
  3102.  
  3103.           See also          See also          ________
  3104.                     sciinfo.                    sciinfo 
  3105.  
  3106.  
  3107.           Return Value          Return Value          ____________
  3108.                     SC_SUCCESS     returned the keyexpr
  3109.                     SC_BADHNDL     .NDX file not open or bad handle
  3110.                     SC_NULLPARM    parameter address null
  3111.  
  3112.  
  3113.           Example          Example          _______
  3114.  
  3115.           #include "SoftC.h"
  3116.           
  3117.           
  3118.           
  3119.           void main()
  3120.           {
  3121.             char ndx, buffer[512];
  3122.           
  3123.             scinit(20);
  3124.             if (sciopen(&ndx,"TEST.NDX") == SC_SUCCESS) {
  3125.               sciexpr(ndx,buffer);
  3126.               printf("key expression = %s",buffer);
  3127.               sciclose(ndx);
  3128.             }
  3129.             scterm();
  3130.           }
  3131.  
  3132.  
  3133.           54    Chapter 6, The SoftC Database Library          54                                         
  3134.  
  3135.  
  3136.           sciinfo          sciinfo          _______
  3137.  
  3138.  
  3139.  
  3140.  
  3141.           Usage          Usage          _____
  3142.                     signed short int sciinfo( signed char handle,                                     sciinfo                                                                               ______ 
  3143.                                               signed char *filename,                                                           ________ 
  3144.                                               signed char *keytype,                                                           _______ 
  3145.                                               signed char *keylen,                                                           ______ 
  3146.                                               signed short int *exprlen );                                                                __________
  3147.  
  3148.  
  3149.           Prototype in          Prototype in          ____________
  3150.                     dbase.h
  3151.  
  3152.  
  3153.           Description          Description          ___________
  3154.                     sciinfo gets  the filename  of the .NDX file associated                    sciinfo                                                
  3155.                     with handle,  the index key type (keytype), the maximum                         ______                       _______              
  3156.                     index key  length (keylen), and the length of the index
  3157.                     key expression (exprlen).
  3158.  
  3159.  
  3160.           See also          See also          ________
  3161.                     sciopen.                    sciopen 
  3162.  
  3163.  
  3164.           Return Value          Return Value          ____________
  3165.                     SC_SUCCESS     returned .NDX file information
  3166.                     SC_BADHNDL     .NDX file not open or bad handle
  3167.                     SC_NULLPARM    parameter address null
  3168.  
  3169.  
  3170.           Example          Example          _______
  3171.  
  3172.           #include <dir.h>
  3173.           #include "SoftC.h"
  3174.           
  3175.           
  3176.           
  3177.           void main()
  3178.           {
  3179.             char ndx, filename[MAXPATH], keytype, keylen, exprlen;
  3180.           
  3181.             scinit(20);
  3182.             if (sciopen(&ndx,"TEST.NDX") == SC_SUCCESS) {
  3183.               sciinfo(ndx,filename,&keytype,&keylen,&exprlen);
  3184.               printf("File name = %s\n",filename);
  3185.               printf("Index key type = %c\n",keytype);
  3186.               printf("Maximum key length = %d\n",keylen);
  3187.               printf("Key expression length = %d\n",exprlen);
  3188.               sciclose(ndx);
  3189.             }
  3190.  
  3191.  
  3192.                                 Chapter 6, The SoftC Database Library    55                                                                         55
  3193.  
  3194.  
  3195.             scterm();
  3196.           }
  3197.  
  3198.  
  3199.  
  3200.  
  3201.  
  3202.           scikadd          scikadd          _______
  3203.  
  3204.  
  3205.  
  3206.  
  3207.           Usage          Usage          _____
  3208.                     signed short int scikadd( signed char handle,                                     scikadd                                                                               ______ 
  3209.                                               signed char *key,                                                           ___ 
  3210.                                               signed long int recno );                                                              _____   
  3211.  
  3212.  
  3213.           Prototype in          Prototype in          ____________
  3214.                     dbase.h
  3215.  
  3216.  
  3217.           Description          Description          ___________
  3218.                     scikadd will  add key  to the  index file  specified by                    scikadd                                                                                      ___                                  
  3219.                     handle.  recno   is  the   data  record  number  to  be                             _____                                         
  3220.                     associated with  key (the  data record  pointed  to  by                                     ___                                   
  3221.                     recno must exist prior to calling scikadd).                                                      scikadd  
  3222.  
  3223.  
  3224.           See also          See also          ________
  3225.                     scikmake.                    scikmake 
  3226.  
  3227.  
  3228.           Return Value          Return Value          ____________
  3229.                     SC_SUCCESS     key added to .NDX file
  3230.                     SC_BADHNDL     .NDX file not open or bad handle
  3231.                     SC_SKFAIL      disk seek failure
  3232.                     SC_WRTFAIL     disk write failure
  3233.                     SC_RDFAIL      disk read failure
  3234.                     SC_MEMERR      memory allocation failure
  3235.                     SC_NULLPARM    parameter address null
  3236.  
  3237.  
  3238.           Example          Example          _______
  3239.  
  3240.           #include <string.h>
  3241.           #include "SoftC.h"
  3242.           
  3243.           
  3244.           void main()
  3245.           {
  3246.             char dbf, ndx, date[9];
  3247.             short result;
  3248.             long recno;
  3249.  
  3250.  
  3251.           56    Chapter 6, The SoftC Database Library          56                                         
  3252.  
  3253.  
  3254.           
  3255.             scinit(20);
  3256.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  3257.               if (sciopen(&ndx,"TEST.NDX") == SC_SUCCESS) {
  3258.                 strcpy(date,"19881201");
  3259.                 scdfputs(dbf,1,date);
  3260.                 result = scdrput(dbf,SC_ADD,&recno)
  3261.                 if (result == SC_SUCCESS)
  3262.                   scikadd(ndx,date,recno);
  3263.                 sciclose(ndx);
  3264.               }
  3265.               scdclose(dbf)
  3266.             }
  3267.             scterm();
  3268.           }
  3269.  
  3270.  
  3271.  
  3272.  
  3273.  
  3274.           scikcur          scikcur          _______
  3275.  
  3276.  
  3277.  
  3278.  
  3279.           Usage          Usage          _____
  3280.                     signed short int scikcur( signed char handle,                                     scikcur                                                                               ______ 
  3281.                                               signed char *key,                                                           ___ 
  3282.                                               signed long int *recno );                                                               _____   
  3283.  
  3284.  
  3285.           Prototype in          Prototype in          ____________
  3286.                     dbase.h
  3287.  
  3288.  
  3289.           Description          Description          ___________
  3290.                     scikcur will return the key value (key) and data record                    scikcur                                                                                                       ___                 
  3291.                     number (recno)  associated with  the current key in the                            _____                                          
  3292.                     index file.
  3293.  
  3294.  
  3295.                     The current key pointer must be set by a call to either
  3296.                     scikfind,  scikfirst,   or  sciklast   before   calling                    scikfind   scikfirst        sciklast                   
  3297.                     scikcur.                    scikcur 
  3298.  
  3299.  
  3300.                     The user must ensure that the buffer used to return the
  3301.                     key is large enough to hold the entire key. The maximum
  3302.                     length of  the key  can be  determined via  a  call  to
  3303.                     sciinfo.                    sciinfo 
  3304.  
  3305.  
  3306.           See also          See also          ________
  3307.                     sciinfo, scikfind, scikfirst, and sciklast.                    sciinfo  scikfind  scikfirst      sciklast 
  3308.  
  3309.  
  3310.                                 Chapter 6, The SoftC Database Library    57                                                                         57
  3311.  
  3312.  
  3313.           Return Value          Return Value          ____________
  3314.                     SC_SUCCESS     key and recno returned
  3315.                     SC_BADHNDL     .NDX file not open or bad handle
  3316.                     SC_END         no current key - no call to scikfind,                                                               scikfind 
  3317.                                    scikfirst, or sciklast had been made to                                   scikfirst,    sciklast                 
  3318.                                    initialize the index pointers.
  3319.                     SC_RDFAIL      read index file failure
  3320.                     SC_SKFAIL      seek failure (bad record address or seek
  3321.                                    fail)
  3322.                     SC_NULLPARM    parameter address null
  3323.  
  3324.  
  3325.           Example          Example          _______
  3326.  
  3327.           #include "SoftC.h"
  3328.           
  3329.           
  3330.           
  3331.           void main()
  3332.           {
  3333.             char ndx, date[9], dat[9];
  3334.             long recno, rnum;
  3335.           
  3336.             scinit(20);
  3337.             if (sciopen(&ndx,"TEST.NDX") == SC_SUCCESS) {
  3338.               date[8] = 0;
  3339.               dat[8] = 0;
  3340.               scikfirst(ndx,date,&recno);
  3341.               scikcur(ndx,dat,&rnum);
  3342.               printf("%s %s %ld %ld\n",
  3343.                 date,dat,recno,rnum);
  3344.               sciclose(ndx);
  3345.             }
  3346.             scterm();
  3347.           }
  3348.  
  3349.  
  3350.  
  3351.  
  3352.  
  3353.           scikdel          scikdel          _______
  3354.  
  3355.  
  3356.  
  3357.  
  3358.           Usage          Usage          _____
  3359.                     signed short int scikdel( signed char handle,                                     scikdel                                                                               ______ 
  3360.                                               signed char *key,                                                           ___ 
  3361.                                               signed long int recno );                                                              _____   
  3362.  
  3363.  
  3364.           Prototype in          Prototype in          ____________
  3365.                     dbase.h
  3366.  
  3367.  
  3368.           58    Chapter 6, The SoftC Database Library          58                                         
  3369.  
  3370.  
  3371.           Description          Description          ___________
  3372.                     scikdel will  remove key  from the index file specified                    scikdel                                                                                         ___                               
  3373.                     by handle.  recno is used along with key to ensure that                       ______   _____                                      
  3374.                     the proper key has been removed from the .NDX file.
  3375.  
  3376.  
  3377.           Return Value          Return Value          ____________
  3378.                     SC_SUCCESS     key removed from .NDX file
  3379.                     SC_BADHNDL     .NDX file not open or bad handle
  3380.                     SC_SKFAIL      disk seek failure
  3381.                     SC_WRTFAIL     disk write failure
  3382.                     SC_RDFAIL      index file read failure
  3383.                     SC_EMPTY       index file is empty - no keys found
  3384.                     SC_NOFIND      desired key was not found
  3385.                     SC_NULLPARM    parameter address null
  3386.  
  3387.  
  3388.           Example          Example          _______
  3389.  
  3390.           #include <string.h>
  3391.           #include "SoftC.h"
  3392.           
  3393.           
  3394.           void main()
  3395.           {
  3396.             char ndx, date[9];
  3397.             long recno;
  3398.           
  3399.             scinit(20);
  3400.             if (sciopen(&ndx,"TEST.NDX") == SC_SUCCESS) {
  3401.               strcpy(date,"19881202");
  3402.               recno = 7L;
  3403.               scikdel(ndx,date,recno);
  3404.               sciclose(ndx);
  3405.             }
  3406.             scterm();
  3407.           }
  3408.  
  3409.  
  3410.  
  3411.  
  3412.  
  3413.           scikfind          scikfind          ________
  3414.  
  3415.  
  3416.  
  3417.  
  3418.           Usage          Usage          _____
  3419.                     signed short int scikfind( signed char handle,                                     scikfind                                                                                ______ 
  3420.                                                signed char method,                                                           ______ 
  3421.                                                signed char *key,                                                            ___ 
  3422.                                                signed long int *recno );                                                                _____   
  3423.  
  3424.  
  3425.                                 Chapter 6, The SoftC Database Library    59                                                                         59
  3426.  
  3427.  
  3428.           Prototype in          Prototype in          ____________
  3429.                     dbase.h
  3430.  
  3431.  
  3432.           Description          Description          ___________
  3433.                     scikfind supports two key search methods (determined by                    scikfind                                               
  3434.                     method): SC_EXACT  - find  an exact  match with key and                    ______                                          ___    
  3435.                     recno, and SC_FIRST - find the first logical occurrence                    _____                                                  
  3436.                     of key  in the index and return the associated recno if                       ___                                         _____   
  3437.                     found.
  3438.  
  3439.  
  3440.                     If a match cannot be found, the current key will be the
  3441.                     physical key  which would  immediately precede key. The                                                                   ___     
  3442.                     current key's  value and  data record  number  will  be
  3443.                     returned in key and recno.                                ___     _____ 
  3444.  
  3445.  
  3446.                     The user must ensure that the buffer used to return the
  3447.                     key is large enough to hold the entire key. The maximum
  3448.                     length of  the key  can be  determined via  a  call  to
  3449.                     sciinfo.                    sciinfo 
  3450.  
  3451.  
  3452.           See also          See also          ________
  3453.                     sciinfo.                    sciinfo 
  3454.  
  3455.  
  3456.           Return Value          Return Value          ____________
  3457.                     SC_SUCCESS     key found
  3458.                     SC_NOFIND      key not found
  3459.                     SC_EMPTY       .NDX file empty - no keys found
  3460.                     SC_BADHNDL     .NDX file not open or bad handle
  3461.                     SC_SKFAIL      seek failure (bad record address or seek
  3462.                                    fail)
  3463.                     SC_RDFAIL      read index file failure
  3464.                     SC_END         end of index file
  3465.                     SC_NULLPARM    parameter address null
  3466.  
  3467.  
  3468.           Example          Example          _______
  3469.  
  3470.           #include <string.h>
  3471.           #include "SoftC.h"
  3472.           
  3473.           
  3474.           void main()
  3475.           {
  3476.             char ndx, key[100];
  3477.             long recno;
  3478.             int result;
  3479.           
  3480.             scinit(20);
  3481.             if (sciopen(&ndx,"TEST.NDX") == SC_SUCCESS) {
  3482.  
  3483.  
  3484.           60    Chapter 6, The SoftC Database Library          60                                         
  3485.  
  3486.  
  3487.               strcpy(date,"19881202");
  3488.               recno = 7L;
  3489.               scikfind(ndx,SC_EXACT,date,&recno);
  3490.               printf("%s\n",scemsg());
  3491.               scdclose(ndx);
  3492.             }
  3493.             scterm();
  3494.           }
  3495.  
  3496.  
  3497.  
  3498.  
  3499.  
  3500.           scikfirst          scikfirst          _________
  3501.  
  3502.  
  3503.  
  3504.  
  3505.           Usage          Usage          _____
  3506.                     signed short int scikfirst( signed char handle,                                     scikfirst                                                                                 ______ 
  3507.                                                 signed char *key,                                                             ___ 
  3508.                                                 signed long int *recno );                                                                 _____   
  3509.  
  3510.  
  3511.           Prototype in          Prototype in          ____________
  3512.                     dbase.h
  3513.  
  3514.  
  3515.           Description          Description          ___________
  3516.                     scikfirst will set the current key pointer to the first                    scikfirst                                              
  3517.                     logical key  in the .NDX and return the key value (key)                                                                       ___ 
  3518.                     and data  record number (recno) associated with the new                                             _____                         
  3519.                     current key.
  3520.  
  3521.  
  3522.                     The user must ensure that the buffer used to return the
  3523.                     key is large enough to hold the entire key. The maximum
  3524.                     length of  the key  can be  determined via  a  call  to
  3525.                     sciinfo.                    sciinfo 
  3526.  
  3527.  
  3528.           See also          See also          ________
  3529.                     sciinfo                    sciinfo
  3530.  
  3531.  
  3532.           Return Value          Return Value          ____________
  3533.                     SC_SUCCESS     key and recno returned
  3534.                     SC_BADHNDL     .NDX file not open or bad handle
  3535.                     SC_EMPTY       .NDX file empty - no keys found
  3536.                     SC_SKFAIL      seek failure
  3537.                     SC_RDFAIL      read index file failure
  3538.                     SC_NULLPARM    parameter address null
  3539.  
  3540.  
  3541.                                 Chapter 6, The SoftC Database Library    61                                                                         61
  3542.  
  3543.  
  3544.           Example          Example          _______
  3545.  
  3546.           #include "SoftC.h"
  3547.           
  3548.           
  3549.           
  3550.           void main()
  3551.           {
  3552.             char ndx, date[9];
  3553.             long recno;
  3554.           
  3555.             scinit(20);
  3556.             if (sciopen(&ndx,"TEST.NDX") == SC_SUCCESS) {
  3557.               date[8] = 0;
  3558.               scikfirst(ndx,date,&recno);
  3559.               printf("%d %ld\n",date,recno);
  3560.               sciclose(ndx);
  3561.             }
  3562.             scterm();
  3563.           }
  3564.  
  3565.  
  3566.  
  3567.  
  3568.  
  3569.           sciklast          sciklast          ________
  3570.  
  3571.  
  3572.  
  3573.  
  3574.           Usage          Usage          _____
  3575.                     signed short int sciklast( signed char handle,                                     sciklast                                                                                ______ 
  3576.                                                signed char *key,                                                            ___ 
  3577.                                                signed long int *recno );                                                                _____   
  3578.  
  3579.  
  3580.           Prototype in          Prototype in          ____________
  3581.                     dbase.h
  3582.  
  3583.  
  3584.           Description          Description          ___________
  3585.                     sciklast will  set the  current key pointer to the last                    sciklast                                               
  3586.                     logical key  in the .NDX and return the key value (key)
  3587.                     and data  record number (recno) associated with the new
  3588.                     current key.
  3589.  
  3590.  
  3591.                     The user must ensure that the buffer used to return the
  3592.                     key is large enough to hold the entire key. The maximum
  3593.                     length of  the key  can be  determined via  a  call  to
  3594.                     sciinfo.                    sciinfo 
  3595.  
  3596.  
  3597.           62    Chapter 6, The SoftC Database Library          62                                         
  3598.  
  3599.  
  3600.           See also          See also          ________
  3601.                     sciinfo;.                    sciinfo;.
  3602.  
  3603.  
  3604.           Return Value          Return Value          ____________
  3605.                     SC_SUCCESS     key and recno returned
  3606.                     SC_BADHNDL     .NDX file not open or bad handle
  3607.                     SC_EMPTY       .NDX file empty - no keys found
  3608.                     SC_SKFAIL      seek failure
  3609.                     SC_RDFAIL      read from index file failure
  3610.                     SC_NULLPARM    parameter address null
  3611.  
  3612.  
  3613.           Example          Example          _______
  3614.  
  3615.           #include "SoftC.h"
  3616.           
  3617.           
  3618.           
  3619.           void main()
  3620.           {
  3621.             char ndx, date[9];
  3622.             long recno;
  3623.           
  3624.             scinit(20);
  3625.             if (sciopen(&ndx,"TEST.NDX") == SC_SUCCESS) {
  3626.               date[8] = 0;
  3627.               sciklast(ndx,date,&recno);
  3628.               printf("%s %ld\n",date,recno);
  3629.               sciclose(ndx);
  3630.             }
  3631.             scterm();
  3632.           }
  3633.  
  3634.  
  3635.  
  3636.  
  3637.  
  3638.           scikmake          scikmake          ________
  3639.  
  3640.  
  3641.  
  3642.  
  3643.           Usage          Usage          _____
  3644.                     signed short int scikmake( signed char datahandle,                                     scikmake                                                                                    __________ 
  3645.                                                signed char indexhandle,                                                           ___________ 
  3646.                                                void **key );                                                      ___   
  3647.  
  3648.  
  3649.           Prototype in          Prototype in          ____________
  3650.                     dbase.h
  3651.  
  3652.  
  3653.                                 Chapter 6, The SoftC Database Library    63                                                                         63
  3654.  
  3655.  
  3656.           Description          Description          ___________
  3657.                     scikmake  will   build  an  index  key  using  the  key                    scikmake                                               
  3658.                     expression of  the index  file specified by indexhandle                                                                ___________
  3659.                     and the  data found  in the  output buffer  of the data
  3660.                     file of  datahandle. Memory  space for  the key will be                             __________                         ___        
  3661.                     allocated  and  the  address  of  this  block  will  be
  3662.                     returned.
  3663.  
  3664.  
  3665.                     The key expression can consist of either the data field
  3666.                     name or one of five dBaseIII functions or a combination
  3667.                     thereof.  Data   field  types   of  date,  numeric,  or
  3668.                     character are  allowed. dBaseIII  functions dtoc, left,                                                                dtoc  left 
  3669.                     right,  str,   and  substr  are  current  supported  by                    right   str         substr                             
  3670.                     scikmake.                    scikmake 
  3671.  
  3672.  
  3673.                     dBaseIII supports only two types of keys: character and
  3674.                     numeric. The  only numeric  keys supported by SoftC are
  3675.                     just the date and numeric data field names.
  3676.  
  3677.  
  3678.                     dtoc will convert data from a date field to a character                    dtoc                                                   
  3679.                     string   of    the   format    mm/dd/yy.   Syntax    is
  3680.                     dtoc(field_name).
  3681.  
  3682.  
  3683.                     left will  return the left portion of a character field                    left                                                   
  3684.                     as a  string. The  number  of  characters  returned  is
  3685.                     specified   after    the   field    name.   Syntax   is
  3686.                     left(field_name,number).
  3687.  
  3688.  
  3689.                     right will  return the  right portion  of  a  character                    right                                                  
  3690.                     field as a string. The number of characters returned is
  3691.                     specified after  the field  name. This  is a count from
  3692.                     the   right    side   of    the   field.    Syntax   is
  3693.                     right(field_name,count).
  3694.  
  3695.  
  3696.                     str will  convert a  numeric field  to an ascii string.                    str                                                    
  3697.                     The total  length of  the  string  and  the  number  of
  3698.                     decimal places  are optional  parameters.  The  default
  3699.                     string length is 10 and the number of decimal places is
  3700.                     0. Syntax is str(field_name,length,decimal_places).
  3701.  
  3702.  
  3703.                     substr will  return the  middle portion  of a character                    substr                                                 
  3704.                     field. The starting offset into the field is a required
  3705.                     parameter. The  number of  characters to  be used is an
  3706.                     optional parameter whose default value is the remainder
  3707.                     of the field. Syntax is substr(field_name,start,count).
  3708.  
  3709.  
  3710.           64    Chapter 6, The SoftC Database Library          64                                         
  3711.  
  3712.  
  3713.                     An example of a more complex key expression:
  3714.  
  3715.  
  3716.                     right(dtoc(date),2)+left(dtoc(date,2)
  3717.  
  3718.  
  3719.                     This expression would cause scikmake to create an index                                                scikmake                   
  3720.                     key string  consisting of  the year and month ("yymm").
  3721.                     For example  if date equals "2/13/89" the resultant key
  3722.                     would be "8902".
  3723.  
  3724.  
  3725.                     Note that  for key  expressions consisting  of only one
  3726.                     numeric or character data field scikmake is probably an                                                    scikmake               
  3727.                     overkill. You  can easily generate these keys yourself.
  3728.                     scikmake is  a fairly  large module  and if  not needed                    scikmake                                               
  3729.                     probably should not be used. This function is best used
  3730.                     for date  keys or  when  the  key  expression  is  more
  3731.                     complex.
  3732.  
  3733.  
  3734.           See also          See also          ________
  3735.                     scicreate.                    scicreate 
  3736.  
  3737.  
  3738.           Return Value          Return Value          ____________
  3739.                     SC_SUCCESS     key and recno returned
  3740.                     SC_BADHNDL     .NDX file not open or bad handle
  3741.                     SC_MEMERR      memory allocation failure
  3742.                     SC_BADEXPR     invalid key expression
  3743.                     SC_NULLPARM    parameter address null
  3744.  
  3745.  
  3746.           Example          Example          _______
  3747.  
  3748.           #include "SoftC.h"
  3749.           
  3750.           
  3751.           
  3752.           void main()
  3753.           {
  3754.             char ndx, dbf, char *key, date[9];
  3755.             long recno;
  3756.           
  3757.             scinit(20);
  3758.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  3759.               if (sciopen(&ndx,"TEST.NDX") == SC_SUCCESS) {
  3760.                 scdfput(dbf,0,&date);
  3761.                 scdrput(dbf,SC_ADD,&recno);
  3762.                 scikmake(dbf,ndx,(void **) &key);
  3763.                 scikadd(ndx,key,recno);
  3764.                 free(key);
  3765.                 sciclose(ndx);
  3766.               }
  3767.  
  3768.  
  3769.                                 Chapter 6, The SoftC Database Library    65                                                                         65
  3770.  
  3771.  
  3772.               scdclose(dbf);
  3773.             }
  3774.             scterm();
  3775.           }
  3776.  
  3777.  
  3778.  
  3779.  
  3780.  
  3781.           sciknext          sciknext          ________
  3782.  
  3783.  
  3784.  
  3785.  
  3786.           Usage          Usage          _____
  3787.                     signed short int sciknext( signed char handle,                                     sciknext                                                                                ______ 
  3788.                                                signed char *key,                                                            ___ 
  3789.                                                signed long int *recno );                                                                _____   
  3790.  
  3791.  
  3792.           Prototype in          Prototype in          ____________
  3793.                     dbase.h
  3794.  
  3795.  
  3796.           Description          Description          ___________
  3797.                     sciknext will  increment the key pointer and return the                    sciknext                                               
  3798.                     key  value   (key)  and   data  record  number  (recno)                                  ___                                _____ 
  3799.                     associated with the new current key.
  3800.  
  3801.  
  3802.                     The current key pointer must be set by a call to either
  3803.                     scikfind,  scikfirst,   or  sciklast   before   calling                    scikfind   scikfirst        sciklast                   
  3804.                     sciknext.                    sciknext 
  3805.  
  3806.  
  3807.                     The user must ensure that the buffer used to return the
  3808.                     key is large enough to hold the entire key. The maximum
  3809.                     length of  the key  can be  determined via  a  call  to
  3810.                     sciinfo.                    sciinfo 
  3811.  
  3812.  
  3813.           See also          See also          ________
  3814.                     sciinfo, scikfind, scikfirst, and sciklast.                    sciinfo  scikfind  scikfirst      sciklast 
  3815.  
  3816.  
  3817.           Return Value          Return Value          ____________
  3818.                     SC_SUCCESS     key and recno returned
  3819.                     SC_BADHNDL     .NDX file not open or bad handle
  3820.                     SC_END         no more keys - at end of .NDX file
  3821.                     SC_RDFAIL      index file read failure
  3822.                     SC_SKFAIL      seek failure (bad record address or seek
  3823.                                    failed)
  3824.                     SC_NULLPARM    parameter address null
  3825.  
  3826.  
  3827.           66    Chapter 6, The SoftC Database Library          66                                         
  3828.  
  3829.  
  3830.           Example          Example          _______
  3831.  
  3832.           #include "SoftC.h"
  3833.           
  3834.           
  3835.           
  3836.           void main()
  3837.           {
  3838.             char ndx, date[9];
  3839.             long recno;
  3840.           
  3841.             scinit(20);
  3842.             if (sciopen(&ndx,"TEST.NDX") == SC_SUCCESS) {
  3843.               scikfirst(ndx,date,&recno);
  3844.               sciknext(ndx,date,&recno);
  3845.               printf("%s %ld\n",date,recno);
  3846.               sciclose(ndx);
  3847.             }
  3848.             scterm();
  3849.           }
  3850.  
  3851.  
  3852.  
  3853.  
  3854.  
  3855.           scikprev          scikprev          ________
  3856.  
  3857.  
  3858.  
  3859.  
  3860.           Usage          Usage          _____
  3861.                     signed short int scikprev( signed char handle,                                     scikprev                                                                                ______ 
  3862.                                                signed char *key,                                                            ___ 
  3863.                                                signed long int *recno );                                                                _____   
  3864.  
  3865.  
  3866.           Prototype in          Prototype in          ____________
  3867.                     dbase.h
  3868.  
  3869.  
  3870.           Description          Description          ___________
  3871.                     scikprev will  decrement the key pointer and return the                    scikprev                                               
  3872.                     key  value   (key)  and   data  record  number  (recno)                                  ___                                _____ 
  3873.                     associated with the new current key.
  3874.  
  3875.  
  3876.                     The current key pointer must be set by a call to either
  3877.                     scikfind,  scikfirst,   or  sciklast   before   calling                    scikfind   scikfirst        sciklast                   
  3878.                     scikprev.                    scikprev 
  3879.  
  3880.  
  3881.                     The user must ensure that the buffer used to return the
  3882.                     key is large enough to hold the entire key. The maximum
  3883.  
  3884.  
  3885.                                 Chapter 6, The SoftC Database Library    67                                                                         67
  3886.  
  3887.  
  3888.                     length of  the key  can be  determined via  a  call  to
  3889.                     sciinfo.                    sciinfo 
  3890.  
  3891.  
  3892.           See also          See also          ________
  3893.                     sciinfo, scikfind, scikfirst, and sciklast.                    sciinfo  scikfind  scikfirst      sciklast 
  3894.  
  3895.  
  3896.           Return Value          Return Value          ____________
  3897.                     SC_SUCCESS     key and recno returned
  3898.                     SC_BADHNDL     .NDX file not open or bad handle
  3899.                     SC_END         no more keys - at end of .NDX file
  3900.                     SC_RDFAIL      index file read failure
  3901.                     SC_SKFAIL      index file record seek failure
  3902.                     SC_NULLPARM    parameter address null
  3903.  
  3904.  
  3905.           Example          Example          _______
  3906.  
  3907.           #include "SoftC.h"
  3908.           
  3909.           
  3910.           
  3911.           void main()
  3912.           {
  3913.             char ndx, date[9];
  3914.             long recno;
  3915.           
  3916.             scinit(20);
  3917.             if (sciopen(&ndx,"TEST.NDX") == SC_SUCCESS) {
  3918.               sciklast(ndx,date,&recno);
  3919.               scikprev(ndx,date,&recno);
  3920.               printf("%s %ld\n",date,recno);
  3921.               sciclose(ndx);
  3922.             }
  3923.             scterm();
  3924.           }
  3925.  
  3926.  
  3927.  
  3928.  
  3929.  
  3930.           scinit          scinit          ______
  3931.  
  3932.  
  3933.  
  3934.  
  3935.           Usage          Usage          _____
  3936.                     signed short int scinit( signed char files );                                     scinit                                                                               _____   
  3937.  
  3938.  
  3939.           Prototype in          Prototype in          ____________
  3940.                     SoftC.h
  3941.  
  3942.  
  3943.           68    Chapter 6, The SoftC Database Library          68                                         
  3944.  
  3945.  
  3946.           Description          Description          ___________
  3947.                     scinit is called once and only once at the beginning of                    scinit                                                 
  3948.                     the program.  The maximum number of simultaneously open
  3949.                     files is  passed.  This  function  sets  up  the  SoftC                    _____                                                  
  3950.                     environment for  processing. Memory  will be  allocated
  3951.                     for a  variety of control structures used internally by
  3952.                     the SoftC manager.
  3953.  
  3954.  
  3955.           See also          See also          ________
  3956.                     scterm.                    scterm 
  3957.  
  3958.  
  3959.           Return Value          Return Value          ____________
  3960.                     SC_SUCCESS     completed initialization
  3961.                     SC_MEMERR      memory allocation failure
  3962.                     SC_BADHNDL     invalid number of handles
  3963.  
  3964.  
  3965.           Example          Example          _______
  3966.  
  3967.           #include "SoftC.h"
  3968.           
  3969.           void main()
  3970.           {
  3971.             scinit(20);
  3972.             scterm();
  3973.           }
  3974.  
  3975.  
  3976.  
  3977.  
  3978.  
  3979.           sciopen          sciopen          _______
  3980.  
  3981.  
  3982.  
  3983.  
  3984.           Usage          Usage          _____
  3985.                     signed short int sciopen( signed char *handle,                                     sciopen                                                                                 ______ 
  3986.                                               signed char *filename );                                                           ________   
  3987.  
  3988.  
  3989.           Prototype in          Prototype in          ____________
  3990.                     dbase.h
  3991.  
  3992.  
  3993.           Description          Description          ___________
  3994.                     sciopen opens  an .NDX  file. Memory  will be allocated                    sciopen                                                
  3995.                     for a file packet, I/O buffers, and other miscellaneous
  3996.                     structures  for   use  internally  by  the  SoftC  file
  3997.                     manager.
  3998.  
  3999.  
  4000.                                 Chapter 6, The SoftC Database Library    69                                                                         69
  4001.  
  4002.  
  4003.           Return Value          Return Value          ____________
  4004.                     SC_SUCCESS     .NDX file opened
  4005.                     SC_MEMERR      memory allocation failure
  4006.                     SC_NOFILE      .NDX file not found
  4007.                     SC_RDFAIL      disk read failure
  4008.                     SC_NONDX       file not in .NDX format
  4009.                     SC_SKFAIL      disk seek failure
  4010.                     SC_NOHNDL      no SoftC handles available
  4011.                     SC_BADFNAME    invalid filename
  4012.                     SC_NULLPARM    parameter address null
  4013.                     SC_KEYLEN      invalid key length
  4014.                     SC_ITEMLEN     invalid key item length
  4015.                     SC_BADROOT     invalid root page number
  4016.                     SC_MAXKEYS     bad maximum number of keys
  4017.                     SC_FILENGTH    invalid file length
  4018.  
  4019.  
  4020.           Example          Example          _______
  4021.  
  4022.           #include "SoftC.h"
  4023.           
  4024.           
  4025.           void main()
  4026.           {
  4027.             char ndx;
  4028.           
  4029.             scinit(20);
  4030.             if (sciopen(&ndx,"UNKNOWN.NDX") == SC_SUCCESS) {
  4031.               sciclose(ndx);
  4032.             }
  4033.             scterm();
  4034.           }
  4035.  
  4036.  
  4037.  
  4038.  
  4039.  
  4040.           scipinfo          scipinfo          ________
  4041.  
  4042.  
  4043.  
  4044.  
  4045.           Usage          Usage          _____
  4046.                     signed short int scipinfo( signed char handle,                                     scipinfo                                                                                ______ 
  4047.                                                signed char *numpgs );                                                            ______   
  4048.  
  4049.  
  4050.           Prototype in          Prototype in          ____________
  4051.                     dbase.h
  4052.  
  4053.  
  4054.           70    Chapter 6, The SoftC Database Library          70                                         
  4055.  
  4056.  
  4057.           Description          Description          ___________
  4058.                     scipinfo gets  the maximum  number of  index pages  the                    scipinfo                                               
  4059.                     SoftC file  manager can  keep in  memory and returns it
  4060.                     via numpgs.                        ______ 
  4061.  
  4062.  
  4063.           Return Value          Return Value          ____________
  4064.                     SC_SUCCESS     max number of pages allowed returned
  4065.                     SC_BADHNDL     .NDX file not open or bad handle
  4066.                     SC_NULLPARM    parameter address null
  4067.  
  4068.  
  4069.           Example          Example          _______
  4070.  
  4071.           #include "SoftC.h"
  4072.           
  4073.           
  4074.           
  4075.           void main()
  4076.           {
  4077.             char ndx, numpgs;
  4078.           
  4079.             scinit(20);
  4080.             if (sciopen(&ndx,"TEST.NDX") == SC_SUCCESS) {
  4081.               scipinfo(ndx,&numpgs) == SC_SUCCESS)
  4082.               printf("Maximum number of pages = %d\n",numpgs);
  4083.               sciclose(ndx);
  4084.             }
  4085.             scterm();
  4086.           }
  4087.  
  4088.  
  4089.  
  4090.  
  4091.  
  4092.           scipnum          scipnum          _______
  4093.  
  4094.  
  4095.  
  4096.  
  4097.           Usage          Usage          _____
  4098.                     signed short int scipnum( signed char handle,                                     scipnum                                                                               ______ 
  4099.                                               signed char *numpgs );                                                           ______   
  4100.  
  4101.  
  4102.           Prototype in          Prototype in          ____________
  4103.                     dbase.h
  4104.  
  4105.  
  4106.           Description          Description          ___________
  4107.                     scipnum sets the maximum number of index pages (numpgs)                    scipnum                                                                                                                    ______ 
  4108.                     the SoftC  file manager  can keep in memory. Memory for
  4109.                     index pages will be freed or allocated as appropriate.
  4110.  
  4111.  
  4112.                                 Chapter 6, The SoftC Database Library    71                                                                         71
  4113.  
  4114.  
  4115.           Return Value          Return Value          ____________
  4116.                     SC_SUCCESS     new max number of pages allowed returned
  4117.                     SC_BADHNDL     .NDX file was open or bad handle
  4118.                     SC_BADCMD      invalid new number of pages requested
  4119.                     SC_NULLPARM    parameter address null
  4120.  
  4121.  
  4122.           Example          Example          _______
  4123.  
  4124.           #include "SoftC.h"
  4125.           
  4126.           
  4127.           
  4128.           void main()
  4129.           {
  4130.             char ndx, numpgs = 5;
  4131.           
  4132.             scinit(20);
  4133.             if (sciopen(&ndx,"TEST.NDX") == SC_SUCCESS) {
  4134.               scipnum(ndx,&numpgs);
  4135.               scipinfo(ndx,&numpgs);
  4136.               printf("New max = %d\n",numpgs);
  4137.               sciclose(ndx);
  4138.             }
  4139.             scterm();
  4140.           }
  4141.  
  4142.  
  4143.  
  4144.  
  4145.  
  4146.           scterm          scterm          ______
  4147.  
  4148.  
  4149.  
  4150.  
  4151.           Usage          Usage          _____
  4152.                     signed short int scterm( void );                                     scterm         
  4153.  
  4154.  
  4155.           Prototype in          Prototype in          ____________
  4156.                     SoftC.h
  4157.  
  4158.  
  4159.           Description          Description          ___________
  4160.                     scterm is called once at the end of the program. Memory                    scterm                                                 
  4161.                     allocated by  scinit for  internal  control  structures                                  scinit                                   
  4162.                     will be  freed. All  files open  will be closed and any
  4163.                     memory allocated for them will be freed.
  4164.  
  4165.  
  4166.           See also          See also          ________
  4167.                     scinit.                    scinit 
  4168.  
  4169.  
  4170.           72    Chapter 6, The SoftC Database Library          72                                         
  4171.  
  4172.  
  4173.           Return Value          Return Value          ____________
  4174.                     SC_SUCCESS     completed initialization
  4175.  
  4176.  
  4177.           Example          Example          _______
  4178.  
  4179.           #include "SoftC.h"
  4180.           
  4181.           void main()
  4182.           {
  4183.             scinit(20);
  4184.             scterm();
  4185.           }
  4186.  
  4187.  
  4188.  
  4189.  
  4190.  
  4191.           scvers          scvers          ______
  4192.  
  4193.  
  4194.  
  4195.  
  4196.           Usage          Usage          _____
  4197.                     signed char * scvers( void );                                  scvers         
  4198.  
  4199.  
  4200.           Prototype in          Prototype in          ____________
  4201.                     SoftC.h
  4202.  
  4203.  
  4204.           Description          Description          ___________
  4205.                     scvers gets the SoftC library revision in the form of a                    scvers                                                 
  4206.                     character string.
  4207.  
  4208.  
  4209.           Return Value          Return Value          ____________
  4210.                     scvers returns the library revision.                    scvers                              
  4211.  
  4212.  
  4213.           Example          Example          _______
  4214.  
  4215.           #include "SoftC.h"
  4216.           
  4217.           
  4218.           void main()
  4219.           {
  4220.             scinit(20);
  4221.             printf("SoftC Database Library Revision %s",scvers());
  4222.             scterm();
  4223.           }
  4224.  
  4225.  
  4226.  
  4227.  
  4228.  
  4229.                                       LICENSE
  4230.                                           
  4231.        
  4232.        SoftC Database Library is Copyright (c) 1988, 1989 by K. Schumann.       SoftC                                                             
  4233.        SoftC Window Library is Copyright (c) 1988, 1989 by L. Olson and K.       SoftC                                                              
  4234.        Schumann.
  4235.        
  4236.        The SoftC libraries are not, nor have they ever been, public domain or           SoftC                                                             
  4237.        free software. The author(s) of the SoftC library(s) retain all rights                                           SoftC                             
  4238.        to the source and object code. Distribution of SoftC library source or                                                      SoftC                  
  4239.        object files without prior written consent from K. Schumann is
  4240.        considered theft and as such will be prosecuted.
  4241.        
  4242.        The SoftC libraries are distributed under the user supported           SoftC                                                   
  4243.        (shareware) software concept.  Non-registered users of the library(s)
  4244.        are granted a limited license to use SoftC for a trial period, in                                            SoftC                       
  4245.        order to determine if it suits their needs.  Any other use of SoftC or                                                                     SoftC   
  4246.        use beyond this trial period requires registration.  Any use of non-
  4247.        registered copies of a SoftC library by a business, organization, or                              SoftC                                        
  4248.        any kind of institution is forbidden.
  4249.        
  4250.        A registered copy of a SoftC library must be treated like a book. Like                              SoftC                                          
  4251.        a book, the same registered copy of SoftC may not be used in more than                                           SoftC                             
  4252.        one computer at the same time. Registered users of SoftC are granted a                                                          SoftC              
  4253.        limited license to include library object code in their products.
  4254.        
  4255.        All users are granted a limited license to copy the SoftC library                                                           SoftC        
  4256.        evaluation kit in an absolutely unmodified form (small memory model
  4257.        object library(s), library header file(s), library reference manual,
  4258.        READ.ME, license agreement, and order form) for the purpose of
  4259.        allowing others to try it.
  4260.        
  4261.        Bulletin Board system operators may post SoftC on their BBS for                                                SoftC                 
  4262.        downloading by their users without written permission only if the
  4263.        above conditions are met, and only if no special fee is necessary to
  4264.        access the SoftC library files (a general fee to access the BBS is                  SoftC                                                  
  4265.        acceptable).
  4266.        
  4267.        Distributors of shareware and public domain software MUST obtain
  4268.        written permission from K. Schumann before distributing a SoftC                                                                 SoftC
  4269.        library evaluation kit and must follow the above conditions.  This is
  4270.        to ensure that the library files being distributed are complete and
  4271.        unmodified.
  4272.  
  4273.  
  4274.      SoftC Libraries                                            Invoice #051089     SoftC                                                                     
  4275.      **************************************************************************
  4276.              Remit to : K. Schumann, 16820 3rd St NE, Ham Lake, MN 55304
  4277.      **************************************************************************
  4278.      
  4279.      Database  Windows   Item                            US/Canada     Price
  4280.  
  4281.      _______   _______   SoftC Source Registration     $100/$125 ea   $________                         SoftC Source Registration      100  125               
  4282.                          (includes full commented source and all
  4283.                          compiler memory models)
  4284.  
  4285.      _______   _______   SoftC Object Registration      $20/$25  ea   $________                         SoftC Object Registration       20  25                
  4286.                          (includes all compiler memory models)
  4287.  
  4288.      _______   _______   SoftC Evaluation Disk          $10/$12  ea   $________                         SoftC Evaluation Disk           10  12                
  4289.                          (does not include registration)
  4290.  
  4291.      _______   _______   SoftC Source Update            $35/$44  ea   $________                         SoftC Source Update             35  44                
  4292.  
  4293.      _______   _______   SoftC Object Update            $15/$19  ea   $________                         SoftC Object Update             15  19                
  4294.      
  4295.                                                        Subtotal       $________
  4296.      
  4297.      Minnesota residents please add 6% sales tax.      Tax            $________
  4298.      
  4299.                                                        Total          $________
  4300.      
  4301.      Check or money order only.  Prices subject to change without notice.
  4302.      Library reference manual and other documentation is included on disk.
  4303.      Registered users are entitled to one free update.
  4304.      
  4305.      **************************************************************************
  4306.      
  4307.      I, the undersigned, have read and understood the terms of the license
  4308.      agreement (LICENSE.DOC) and agree to be bound by its conditions.
  4309.      
  4310.      Signature_________________________________________________________________
  4311.      
  4312.      Name______________________________________________________________________
  4313.      
  4314.      Company___________________________________________________________________
  4315.      
  4316.      Address___________________________________________________________________
  4317.      
  4318.      City______________________________________State_________Zip_______________
  4319.      
  4320.      Phone (______)_____________________     Bus. (______)_____________________
  4321.      
  4322.      Compiler Vendor_______________________________ Version____________________
  4323.      
  4324.      Where did you obtain SoftC?_______________________________________________                          SoftC                                                
  4325.      
  4326.      Comments__________________________________________________________________
  4327.      
  4328.      __________________________________________________________________________
  4329.      
  4330.      __________________________________________________________________________
  4331.      
  4332.  
  4333.  
  4334.           
  4335.  
  4336.  
  4337.           Appendix C          Appendix C
  4338.  
  4339.  
  4340.           Revision History          Revision History
  4341.  
  4342.  
  4343.  
  4344.  
  4345.           v1.00 (December of 1988)          v1.00 (December of 1988)
  4346.  
  4347.           Initial release  of library.  Included dBaseIII+  data and  index
  4348.           file access  routines  (including  individual  record  and  field
  4349.           access functions), and text windowing and related functions.
  4350.  
  4351.  
  4352.           v1.01 (February of 1989)          v1.01 (February of 1989)
  4353.  
  4354.           Fixes for 5 problems included:
  4355.  
  4356.  
  4357.           1)   Could not  properly access  fields whose  offset in the data
  4358.           record  is   beyond  128.  Error  functions:  scdfget,  scdfgets,                                                        scdfget   scdfgets 
  4359.           scdfput, scdfputs.          scdfput  scdfputs 
  4360.  
  4361.  
  4362.           2)   Could not  properly store  data in a numeric field when zero
  4363.           was specified  for number  of  decimal  places.  Error  function:
  4364.           scdfput.          scdfput 
  4365.  
  4366.  
  4367.           3)   Could not  correctly find  the first  item of a LONG list of                                                               LONG        
  4368.           items using the same index key value. Error function: scikfind.                                                                scikfind 
  4369.  
  4370.  
  4371.           4)   Did not  correctly set the text colors after the last window
  4372.           had been closed. Error function: scwclose.                                           scwclose 
  4373.  
  4374.  
  4375.           5)   Could not  open dBaseIII+ data and index files properly. Was
  4376.           able to  open Clipper  and dBC3+  files. dBaseIII+,  Clipper, and
  4377.           dBC3+ could  open files  created  by  library.  Error  functions:
  4378.           scdopen, sciopen.          scdopen  sciopen 
  4379.  
  4380.  
  4381.           Thirteen new  functions were added to the library: an error clear
  4382.           (sceclr), cursor on/off (scwcurson, scwcursoff), a powerful index           sceclr                  scwcurson  scwcursoff                   
  4383.           key builder (scikmake), and 9 date functions.                       scikmake                        
  4384.  
  4385.  
  4386.           The  date   functions  include:   week  day  (sccday)  and  month                                                        sccday             
  4387.           (sccmonth)  string return functions, 2 leap year testing routines           sccmonth                                                        
  4388.           - one  for a  string (sccleap)  and  the  other  for  an  integer                                sccleap                                    
  4389.           (sccleapi), a  date string  validation function  (sccdvalid), two           sccleapi                                         sccdvalid      
  4390.           date translation  functions: one  to  convert  from  integers  to
  4391.  
  4392.  
  4393.           76    Appendix C, Revision History          76                                
  4394.  
  4395.  
  4396.           "yyyymmdd"  strings  (sccdn2s)  and  vice  versa  (sccds2n),  and                                sccdn2s                      sccds2n       
  4397.           another  to   convert  between   "yyyymmdd"  and   "mm/dd/yy"  or
  4398.           "mm/dd/yyyy"  strings   (sccdxlat),  and  the  last  function  to                                   sccdxlat                                
  4399.           calculate  the  difference  in  days  between  two  date  strings
  4400.           (sccddiff).           sccddiff  
  4401.  
  4402.  
  4403.           Function scdcreate  was modified  to  allow  only  19  characters                   scdcreate                                               
  4404.           maximum for  numeric fields.  This brought  the function  in line
  4405.           with dBaseIII+.
  4406.  
  4407.  
  4408.           The way  scdfget and  scdfput handled  date fields was changed to                   scdfget      scdfput                                    
  4409.           use a nine character string formatted as "mm/dd/yy".
  4410.  
  4411.  
  4412.           Also I  publicized my  GEnie GEMail  address  as  another  method
  4413.           whereby I could be contacted.
  4414.  
  4415.  
  4416.           v1.02 (April of 1989)          v1.02 (April of 1989)
  4417.  
  4418.           Due to  numerous problems  found in  scikadd and  scikdel,  these                                               scikadd      scikdel        
  4419.           functions were  completely rewritten.  One new function was added
  4420.           to the  library: sccds2l  which translates string dates to longs.                           sccds2l                                         
  4421.           This function was originally part of sccddiff.                                               sccddiff 
  4422.  
  4423.  
  4424.           Error checking  was tightened.  Most functions now check for NULL
  4425.           pointers as passed parameters. Certain errors such as file length
  4426.           have been  changed  to  warnings.  Additional  errors  have  been
  4427.           defined to  pinpoint the  failure  more  closely,  especially  in
  4428.           scdopen and  sciopen, but  this affects  many other  functions as          scdopen      sciopen                                             
  4429.           well.
  4430.  
  4431.  
  4432.           The "text  window"  functions  were  removed  from  this  library
  4433.           because its  focus was  narrowed  to  dBaseIII+  compatible  file
  4434.           access. Many  users expressed  a desire to use their own favorite
  4435.           windows toolkit.  The window  functions have been placed in their
  4436.           own library, and menu and atgets have been added.
  4437.  
  4438.  
  4439.           Registration fees were changed to better reflect the value of the
  4440.           toolkit. Object  code level  registration is $20, and source code
  4441.           level is $100.
  4442.  
  4443.  
  4444.           Microsoft C v5.1 was now supported along with Quick C v2.0.
  4445.  
  4446.  
  4447.           The number of header files was reduced to one.
  4448.  
  4449.  
  4450.                                          Appendix C, Revision History    77                                                                         77
  4451.  
  4452.  
  4453.           An extensive  suite  of  tests  were  written  to  enable  better
  4454.           debugging of future versions of the library.
  4455.  
  4456.  
  4457.           v1.03 (May of 1989)          v1.03 (May of 1989)
  4458.  
  4459.           Three problems were corrected:
  4460.  
  4461.  
  4462.           1)   May or  may not  be able  to find  a particular  numeric (or
  4463.           date) key when searching the index file b-tree. This problem also
  4464.           affected adding  numeric (and  date) keys to an index file. Error
  4465.           function: scikfind.                    scikfind 
  4466.  
  4467.  
  4468.           2)   Date keys  were not  being built properly by scikmake. Index                                                            scikmake       
  4469.           key being  built  was  not  compatible  with  dBase  III+.  Error
  4470.           function: scikmake.                    scikmake 
  4471.  
  4472.  
  4473.           3)   Minor problem  when releasing  unused index  pages.  Failure
  4474.           would  not   occur  under   normal  operating  conditions.  Error
  4475.           function: scikdel.                    scikdel 
  4476.  
  4477.  
  4478.                                        INDEX
  4479.  
  4480.  
  4481.             dtoc  12, 63                                            scikfirst  11, 56, 57, 60,
  4482.             left  12, 63                                                65, 66, 67
  4483.             right  12, 63                                            sciklast  11, 56, 57, 61,
  4484.             sc_code  15, 16, 48                                                65, 66, 67
  4485.             sccday  13, 18, 26, 75                                            scikmake  12, 52, 55, 62,
  4486.             sccddiff  13, 19, 76                                                63, 64, 75, 77
  4487.             sccdn2s  13, 19, 20, 22, 76                                            sciknext  11, 65
  4488.             sccds2l  13, 21, 76                                            scikprev  11, 66
  4489.             sccds2n  13, 20, 21, 22, 76                                            scinit  2, 5, 15, 67, 68,
  4490.             sccdvalid  14, 19, 20, 22,                                                71
  4491.                 23, 75                                            sciopen  11, 54, 68, 75, 76
  4492.             sccdxlat  13, 19, 23, 76                                            scipinfo  11, 69, 70
  4493.             sccleap  14, 24, 25, 75                                            scipnum  11, 70
  4494.             sccleapi  14, 24, 25, 75                                            scterm  5, 9, 15, 68, 71
  4495.             sccmonth  13, 18, 26, 75                                            scvers  15, 72
  4496.             scdclose  9, 27                                            str  12, 63
  4497.             scdcreate  9, 10, 28, 76                                            substr  12, 63
  4498.             scdfget  10, 29, 30, 31,
  4499.                 35, 36, 43, 75, 76
  4500.             scdfgets  10, 30, 31, 36,
  4501.                 37, 75
  4502.             scdfinfo  30, 31, 32, 33
  4503.             scdfnam2no  11, 34
  4504.             scdfput  10, 30, 35, 36,
  4505.                 37, 45, 75, 76
  4506.             scdfputs  10, 31, 35, 36,
  4507.                 43, 45, 75
  4508.             scdinfo  9, 37, 38
  4509.             scdopen  9, 27, 38, 39, 75,
  4510.                 76
  4511.             scdrclear  10, 39, 40
  4512.             scdrcopy  10, 40, 41
  4513.             scdrdel  10, 41, 42, 46
  4514.             scdrget  9, 30, 31, 42, 43,
  4515.                 45
  4516.             scdrinfo  10, 33, 44
  4517.             scdrput  9, 45
  4518.             scdrundel  10, 42, 46
  4519.             scdsize  9, 47
  4520.             sceclr  15, 48, 50, 75
  4521.             scemsg  15, 48, 49, 50
  4522.             sciclose  11, 50, 51
  4523.             scicreate  11, 51, 52, 64
  4524.             sciexpr  11, 53
  4525.             sciinfo  11, 53, 54, 56,
  4526.                 59, 60, 61, 62, 65, 67
  4527.             scikadd  12, 55, 76
  4528.             scikcur  12, 56
  4529.             scikdel  12, 57, 58, 76, 77
  4530.             scikfind  11, 56, 57, 58,
  4531.                 59, 65, 66, 67, 75, 77
  4532.  
  4533.  
  4534.  
  4535.                                          78